Skip to content
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

Allow providing custom error funcs in strict chi server #649

Merged
merged 3 commits into from Jul 25, 2022
Merged

Allow providing custom error funcs in strict chi server #649

merged 3 commits into from Jul 25, 2022

Conversation

chadweimer
Copy link
Contributor

The new strict server option is great, but it doesn't provide an option to supply custom error functions like the standard server offers. This change adds options to optionally supply custom functions for both request and response errors via separate funcs. It defaults to functions that should preserve existing behavior.

One use case for this is when you don't want to send the detailed error back to the client, thus revealing details of the server, and instead want to log it and return a generic error in its place.

Copy link
Contributor

@Warboss-rus Warboss-rus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great change, no compatibility issues. As an author of strict, I would love for this to be merged.

@deepmap-marcinr deepmap-marcinr merged commit 2feb91c into deepmap:master Jul 25, 2022
@chadweimer chadweimer deleted the feature/custom-error-funcs branch December 21, 2022 02:09
adrianpk pushed a commit to foorester/oapi-codegen that referenced this pull request Jan 16, 2024
* Allow providing custom error funcs

* Added options to struct

* Regenerate examples
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants