-
Notifications
You must be signed in to change notification settings - Fork 1
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
Exceptions being thrown instead handling errors in result pattern #2
Comments
Ah. Yeah. This is an issue with the library I'm using for making the HTTP requests CardboardBox.Http. This will come in the form of a configuration option //On individual APIs:
var api = MangaDex.Create(throwOnError: true);
//On DI services:
services.AddMangaDex(throwOnError: true);
//Via configuration:
{
"MangaDex": {
"ThrowOnError": true
}
} I'll update this issue once said change has been made, and nuget has indexed the update. Edit: There is also a new property on all MD return root objects called |
Got it, I will be waiting the change. As you already may know, the currently exception throwing make error investigation hard to be done (like 400 - bad requests), since we haven't response body to check what is wrong in our payload. Handling errors inside our own applications, as you intend to release, should fit perfectly. Thanks! |
The change has been committed. Just waiting on Nuget to index the change and then you can update to version 1.0.18 and it should start returning the errors to you instead of throwing exceptions. If you want it to start throwing exceptions again, you'll need to set |
I will be able to check in next few hours. |
I just checked it and stopped to throw exceptions. Thank you, I will close this issue. Thanks for your time and fast fixing! I am also receiving an error while trying to upload a file, and there is no info inside the returned object. Looks like a failure when the lib tries to parse the json of a bad request error response. I only can analyze it better later. If I notice that makes sense i am going to open a new issue, okay? Right now I am watching the final match of a soccer cup here in my country 😂 edit: does not look related to mangadex-sharp. I downloaded it and cardboardbox.http source and, while debugging, found an 400 response with html body:
I will try to contact mangadex. Thanks again! |
Hello. First of all, thanks for writing this awesome library. I am surely going to use it in my next project.
Today I faced an exception while querying GET /upload (swagger ref). When there is none pending upload, the endpoint returns a 404 Status Code with a description inside the body response. But even as a error statuscode, it can be a valid scenario when we need to check pending uploads to continue/abandon.
Sample code:
HttpRequestException:
Response status code does not indicate success: 404 (Not Found).
I have been expecting to handle error in response, not using try/catch (because 404 is ). Something like that:
Did I mistaken in something?
Thanks in advance!
The text was updated successfully, but these errors were encountered: