question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

api.Spectator.GetCurrentGameAsync throws an exception

See original GitHub issue

Why does await api.Spectator.GetCurrentGameAsync throw an exception if the player is not in a game? It should either return the correct CurrentGame with populated data or return null.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
MingweiSamuelcommented, Jan 31, 2020

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.

1reaction
JanOubornycommented, Feb 1, 2020

I’m fairly sure, that returning a 404 error is the intended behavior, when the summoner isn’t in a game.

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - RestSharp GetAsync throws an Exception instead of ...
I'm getting an exception instead of a HttpStatusCode.BadResult when I use GetAsync RestSharp method. Request failed with status code BadRequest.
Read more >
HttpClient.GetAsync throws an exception, if server ...
HttpClient.GetAsync throws an exception, if server response has more than one "WWW-Authenticate: Basic" header with different realms.
Read more >
HttpClient.GetAsync can throw UriFormatException #4201
UriFormatException is never thrown by the HttpClient.GetAsync method. If you check the code, there is a function CreateUri that accepts both ...
Read more >
HttpClient.GetAsync Method (System.Net.Http)
In case of timeout, different exceptions are thrown on different .NET implementations. HttpRequestException is thrown on all applicable .NET Framework versions.
Read more >
How to handle failed API calls in C# - ...
What I'd like to do is when the response has a status of 401 - Unauthorized, instead of throwing an exception or returning...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found