Skip to content
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

Error Handling #1

Open
Pluriscient opened this issue Dec 30, 2017 · 2 comments
Open

Error Handling #1

Pluriscient opened this issue Dec 30, 2017 · 2 comments

Comments

@Pluriscient
Copy link

When encountering an error in the request, like a 404 when getting a player, the api currently throws an error. As throwing errors is quite expensive, I would prefer for there to be a way to handle these request exceptions myself, like being able to pass an error handler to the client, or perhaps being able to pass a custom apirequester.

@AeonLucid
Copy link
Member

Being able to pass an error handler sounds good, but I don't have experience creating something like that.
If you want to make a PR or work out the idea more, go ahead.

@Pluriscient
Copy link
Author

At the moment there are two main ways of handling this that I'm thinking of:

  • add an argument to the constructor of the ApiRequester as Func<HttpResponseMessage> which will then be called when there isn't a successful response while null is returned.
  • Allow for a custom ApiRequester to be passed to the RLSClient
    Currently I'm leaning more towards the first option, so let me know if you'd really prefer the second

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants