paquettg / leaguewrap

League of Legend API wrapper
MIT License
67 stars 28 forks source link

LeagueWrap\Response\Http404 / Resource not found / thrown AbstractApi.php on line 553 #75

Closed oimel closed 9 years ago

oimel commented 9 years ago

Hello, I know this isn't a support forum, but I hope you will help me nonetheless. I've never worked with composer before (I'm new to this web thing). So I downloaded and installed wamp and composer. I created the dependencies json file in my project folder and added leaguewrap to it. After that I ran 'php composer.phar install' which worked fine. I also added the requirement for the autoload file to my index.php. I can search for a summoner and get all the info etc. My problems start when I enter a summoner that doesn't exist. It throws out this error (index.php included): http://pastebin.com/3tFnBYb6

I tried following the examples for http exceptions in the readme, but I can't even add 'catch (LeagueWrap\Response\Http404)' without causing a syntax error.

Can you help me, please?

Thanks in advance.

paquettg commented 9 years ago

You need to implemnent a try catch block to catch the exception.

http://php.net/manual/en/language.exceptions.php

You can't just add the catch(...) line, you need to have it follow a try block first. Hopefully the above link will also help you with your problem.

oimel commented 9 years ago

Thanks for the quick response. I did use try, but catch doesn't work because of "syntax error, unexpected ')', expecting variable (T_VARIABLE)" http://pastebin.com/R0fPF0jY

dnlbauer commented 9 years ago

Plesse read the posted link carefully. You are missing a variable for your exception:

catch(Exception $e) {....} On May 1, 2015 12:36 PM, "oimel" notifications@github.com wrote:

Thanks for the quick response. I did use try, but catch doesn't work because of "syntax error, unexpected ')', expecting variable (T_VARIABLE)" http://pastebin.com/R0fPF0jY

— Reply to this email directly or view it on GitHub https://github.com/paquettg/leaguewrap/issues/75#issuecomment-98097405.

oimel commented 9 years ago

Well, that's embarrassing. It's running now, thank you for your help and time.