paquettg / leaguewrap

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

Crashes for Summoner with no Ranked Stats #51

Closed ctsstc closed 9 years ago

ctsstc commented 9 years ago

When trying to call league function with a summoner that has no ranked stats it dies.

Edit: this might just be a bug on Riots side, it will return 404s and 503s. but it seems that I have no issues getting the league for players that are ranked.

dnlbauer commented 9 years ago

can you please show a stackstrace and the code you are using?

ctsstc commented 9 years ago

I've seen a lot of threads on the lol developer site about intermittent 503's I did realize that a 404 is returned for a user that does not have ranked game play / a league. Could the function just return false instead of causing a 500 sever error. I know I could try/catch this, but I feel that it would be great funcationality to handle it internally and return false.

Here's Slim's auto stack trace: http://pastebin.com/CmRwba0U it seems that there's no longer 503 errors happening so I assume RIOT has fixed that problem.

Example Code: http://pastebin.com/5pABxp6Y

dnlbauer commented 9 years ago

I think its not a good idea to just return false because there are multiple reasons why a request wasnt successfull. For example from a false, you dont know if its an error on riot side (505), a problem on your own connection, or if there simply is no summoner or stat for the given input (404).

With the Exceptions you can handle each scenario.

ctsstc commented 9 years ago

I was saying to only return false for 404's when there's no summoner found. 503's should crash the system, I understand that error handling with a try/catch should be done, it would be really nice and convenient for the 404's though to just have a false returned w/o needing to wrap them, but I do understand that with that implementation you would still need to safely wrap a try/catch to handle any of the other errors.