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

Add a generic error handler that returns the application's default media type #1507

Closed
jmvrbanac opened this issue May 5, 2019 · 4 comments
Labels
bug enhancement needs contributor Comment on this issue if you'd like to volunteer to work on this. Thanks!
Milestone

Comments

@jmvrbanac
Copy link
Member

jmvrbanac commented May 5, 2019

If a generic Python exception is raised while running in gunicorn. The user will see an HTML Internal Server Error even though the default media type is application/json. This is due to the exception getting raised to the WSGI server which is defaulting the output. We should gracefully handle this with the default media type. According to the the WSGI spec applications should In general, applications should try to trap their own, internal errors, and display a helpful message in the browser.

Tasks:

  1. Add a default handler that can be overridden
  2. Output a notice and hint to wsgi.errors / stderr?
  3. Add Recipe in docs Add to documentation about adding error handling.
@jmvrbanac jmvrbanac added this to the Version 3.0 milestone May 6, 2019
@jmvrbanac jmvrbanac added enhancement needs contributor Comment on this issue if you'd like to volunteer to work on this. Thanks! bug labels May 6, 2019
@csojinb
Copy link
Contributor

csojinb commented May 6, 2019

I am taking a look at this -- wip

@csojinb
Copy link
Contributor

csojinb commented May 6, 2019

@jmvrbanac for #3 -- do you mean a recipe for overriding the handler?

@jmvrbanac
Copy link
Member Author

@csojinb Sorry, I should've called that "example" or something a bit clearer instead. The idea is that this is something people end up doing more often than we thought, so just having a code example showing how a user would go about doing this.

@vytas7
Copy link
Member

vytas7 commented Nov 3, 2019

Resolved in #1527 [Merged]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug enhancement needs contributor Comment on this issue if you'd like to volunteer to work on this. Thanks!
Projects
None yet
Development

No branches or pull requests

3 participants