-
Notifications
You must be signed in to change notification settings - Fork 130
add some changes in [ChopperException] class #661
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
base: develop
Are you sure you want to change the base?
Conversation
|
Hi, While I appreciate the effort, this is far too naive and needs a lot more work + the mandatory tests. There are a couple dozen of HTTP exceptions to handle and a simple enum just won't do. FYI I have created a Chopper plugin for Talker for pretty-printing errors Frezyx/talker#355 and it should come out in the next major release. This PR here could enhance the data it receives from the @Guldem care to throw an eye on this? |
| unknown, | ||
| } | ||
|
|
||
| extension ChopperExceptionTypeDescription on ChopperExceptionType { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With enhanced enums in Dart 3, creating extensions like these is no longer necessary. You can simply add a the method toPrettyDescription to the ChopperExceptionType enum.
| throw ChopperException( | ||
| request: request, | ||
| type: ChopperExceptionType.unknown, | ||
| error: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the benefit of all of this? The type is unknown and the error is basically the same.
| throw ChopperException( | ||
| request: chain.request, | ||
| type: ChopperExceptionType.unknown, | ||
| error: 'Unsupported response type: ${BodyType.runtimeType}', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than writing a "pretty" message, this the ChopperException should consume a StackTrace
|
Extending the But I missing the point of providing Http information in the There is a chopper/chopper/lib/src/response.dart Line 86 in ea58a0e
Still not sure if the package should do the error handling for http responses. |
Changed in ChopperException class to handle HTTP errors in a clear and structured way. This improves error reporting and makes it easier to manage failed responses gracefully.
Kindly consider accepting the request if it fits the direction of the project. 🙏