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

How to handle HTTP errors #66

Open
PhilippMolitor opened this issue Jan 26, 2021 · 4 comments
Open

How to handle HTTP errors #66

PhilippMolitor opened this issue Jan 26, 2021 · 4 comments

Comments

@PhilippMolitor
Copy link

I implemented this library and immediately noticed that there is no example or documentation on how to include routing-controller's HttpErrors in the generated spec.
Is there a defined best-practice how to add the spec for a method that is able to throw e.g. a NotFoundError?

@epiphone
Copy link
Owner

No, there isn't. You could use the OpenAPI decorator to add a responses.404 property, or perhaps write another decorator that calls OpenAPI internally to save a bit of typing.

Please share here if you come up with a better solution!

@PhilippMolitor
Copy link
Author

Is there any plan on supporting that? This seems like a core component to me. Imagine @ErrorResponseSchema(NotFoundError).

@epiphone epiphone changed the title Undocumented handling of routing-controller errors How to handle HTTP errors Jan 26, 2021
@epiphone
Copy link
Owner

No plans, nope. PRs are welcome 👍

@bratanon
Copy link

+1 for this feature

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

No branches or pull requests

3 participants