-
-
Notifications
You must be signed in to change notification settings - Fork 53
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
Add default conformance of ResponseGenerator for HTTPResponseError #502
Add default conformance of ResponseGenerator for HTTPResponseError #502
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #502 +/- ##
==========================================
- Coverage 84.86% 83.04% -1.83%
==========================================
Files 98 95 -3
Lines 5320 4287 -1033
==========================================
- Hits 4515 3560 -955
+ Misses 805 727 -78 ☔ View full report in Codecov by Sentry. |
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.
This could be an alternative to what we have. I’ll need to have a think about it.
} | ||
|
||
extension HTTPResponseError { | ||
public func body(allocator: ByteBufferAllocator) -> ByteBuffer? { |
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.
Given you have provided a default implementation here, HTTPError won't output any errors now.
My hope is that If ideologically it is not right to do so, I can accept that. If you stop converting |
HTTPResponseError is a protocol you conform your error to, if you want to generate a response from that error. It doesn't require a definition for the error body as it could come in many forms, a string, buffer, object. How you generate a response from that is defined in your implementation of |
Ok. HTTPResponseError is not the utility I thought it was. I can agree with the design approach, so I will close this PR. Thank you. |
This is one of the solution of #501.
Add default conformance of ResponseGenerator for HTTPResponseError