-
Notifications
You must be signed in to change notification settings - Fork 43
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 error handling middleware #126
Add error handling middleware #126
Conversation
Tests/OpenAPIRuntimeTests/Interface/Test_ErrorHandlingMiddleware.swift
Outdated
Show resolved
Hide resolved
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.
Thanks for picking this up @gayathrisairam!
I've left some initial comments / questions, and a note on how you can run the linters locally.
Tests/OpenAPIRuntimeTests/Interface/Test_ErrorHandlingMiddleware.swift
Outdated
Show resolved
Hide resolved
Tests/OpenAPIRuntimeTests/Interface/Test_ErrorHandlingMiddleware.swift
Outdated
Show resolved
Hide resolved
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.
Looks great overall, added a few suggestions for more polish, mainly in the doc comments.
Tests/OpenAPIRuntimeTests/Interface/Test_ErrorHandlingMiddleware.swift
Outdated
Show resolved
Hide resolved
d235fb3
to
60cb9b9
Compare
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.
Thanks for the fixes, added a few more minor suggestions as part of the final pass
Tests/OpenAPIRuntimeTests/Interface/Test_ErrorHandlingMiddleware.swift
Outdated
Show resolved
Hide resolved
Tests/OpenAPIRuntimeTests/Interface/Test_ErrorHandlingMiddleware.swift
Outdated
Show resolved
Hide resolved
Tests/OpenAPIRuntimeTests/Interface/Test_ErrorHandlingMiddleware.swift
Outdated
Show resolved
Hide resolved
Tests/OpenAPIRuntimeTests/Interface/Test_ErrorHandlingMiddleware.swift
Outdated
Show resolved
Hide resolved
@gayathrisairam please rerun the formatter and unit tests, those are failing |
Co-authored-by: Honza Dvorsky <[email protected]>
Co-authored-by: Honza Dvorsky <[email protected]>
Co-authored-by: Honza Dvorsky <[email protected]>
Co-authored-by: Honza Dvorsky <[email protected]>
Co-authored-by: Honza Dvorsky <[email protected]>
Co-authored-by: Honza Dvorsky <[email protected]>
Co-authored-by: Honza Dvorsky <[email protected]>
Co-authored-by: Honza Dvorsky <[email protected]>
…re.swift Co-authored-by: Honza Dvorsky <[email protected]>
Co-authored-by: Honza Dvorsky <[email protected]>
Co-authored-by: Honza Dvorsky <[email protected]>
Co-authored-by: Honza Dvorsky <[email protected]>
Co-authored-by: Honza Dvorsky <[email protected]>
0eeeb48
to
4e7c638
Compare
Looks great, thank you @gayathrisairam! 👏 |
Motivation
Implementation of Improved error handling proposal
Modifications
Added HTTPResponseConvertible protocol
Added ErrorHandlingMiddleware that converts errors confirming to HTTPResponseConvertible to a HTTP response.
Result
The new middleware is an opt-in middleware. So there won't be any change to existing clients.
Clients who wish to have OpenAPI error handling can include the new error middleware in their application.
Test Plan
Added E2E tests to test the new middleware.