-
Notifications
You must be signed in to change notification settings - Fork 144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
api.Spectator.GetCurrentGameAsync throws an exception #647
Comments
Okay so upon further testing of this function I can confidently say that it doesn't work properly when a summoner leaves a match. Here's the code that I used https://pastebin.com/eCPQzsFB How it behaves: It prints out a message when user entered a match, but when player leaves a match, the GetCurrentGameAsync sometimes throws an exception, sometimes it returns data of an already ended match and it's doing so for a few minutes after the player already left the match. |
Is this issue based on RiotApi or RiotSharp? |
RiotApi is a class within RiotSharp, so not sure exactly what you're asking. There's the exact code so you can check it out. |
It's a question of whether this is an issue with Riot Game's API (https://developer.riotgames.com/) or RiotSharp. The API returns a 404 when the summoner is not in the game, so RiotSharp throws an error for that (I believe). (It doesn't necessarily have to behave this way). If you're getting data back after a match ended, that is going to be 100% on Riot's API end. RiotSharp just handles requests to the API and returns whatever the API gave back. |
I see, yeah makes sense. It's unfortunate that it throws error with "404 - Data not found" tho instead of simply returning null.
I'll do some more testing and contact Riot then. |
I'm fairly sure, that returning a 404 error is the intended behavior, when the summoner isn't in a game. |
One could argue 404 is null in http |
I would argue 204 is more like null than 404 is, but Riot's API doesn't give 204s unfortunately |
Okay so I've contacted Riot and asked about this issue - why is their endpoint |
Why does
await api.Spectator.GetCurrentGameAsync
throw an exception if the player is not in a game? It should either return the correctCurrentGame
with populated data or return null.The text was updated successfully, but these errors were encountered: