-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Misleading error response when JSON data can not be composed #2323
Comments
Could you provide a minimal runnable example so we can directly run and reproduce your issue? |
@AlexV525 sure here it is. The logger interceptor outputs the following:
But the base exception has a status code of 500. |
What is the base exception you are indicating? |
The exception dio throws in case something is wrong with the response |
Your log does not tell 500, and neither your example does. The log interceptor only tells that the conversion error happens. |
Try to remove the log interceptor :) |
Again, we don't manipulate the response. It is very likely that the 500 returned from your server, rather than this library. |
Package
dio
Version
5.4.3+1
Operating-System
Windows
Adapter
Default Dio
Output of
flutter doctor -v
Dart Version
3.5.3
Steps to Reproduce
Was told in #2322 that you do not manipulate error codes. Thus I want to open a bug report stating, that it is misleading to get a 500 exception when Dio failed to compose a valid JSON object.
Steps to reproduce
Expected Result
Dio should respond with a different status code in this case. Maybe 499 so the developer knows it's the clients fault.
Actual Result
Just a Dio exception with a status code 500. When you activate the logging interceptor it outputs the JSON compose error. That helped me solve my problem but I still think a different status code should be used.
The text was updated successfully, but these errors were encountered: