Repository navigation
Hide a 500's exception text by default, with an error id (closes #35) - #52
Open
thorwhalen wants to merge 1 commit into
Open
thorwhalen wants to merge 1 commit into
thorwhalen wants to merge 1 commit into
Conversation
PY2HTTP_EXPOSE_ERRORS=1 sends the text again; OPAQUE_ERRORS still forces the generic message. Bottle, Flask and aiohttp handlers share server_error_message.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Approve = merge. This changes what clients see on a 500, so it is opened for a maintainer decision and not merged (option 1 of #35).
What.
server_error_message(error)is the one place a 500's text is decided, used by the Bottle, Flask and aiohttp handlers. By default the client getsInternal server error (error id <12 hex>)and the exception is logged (logger.error, with traceback) under that id.PY2HTTP_EXPOSE_ERRORS=1sendsstr(error)as before (development).OPAQUE_ERRORSis still honoured and wins over expose. 4xx answers are unchanged.Who is affected. A client or test that reads the exception text from a 500 body sees the generic message unless the server sets
PY2HTTP_EXPOSE_ERRORS. Dependents were not run (priv test-dependents py2httpbelongs before merge).Options. (1) this PR; (2) keep sending the text and document
OPAQUE_ERRORSas the production setting.Default: (1), matching i2mint/qh#18 and the aiohttp handler, which already hid the text.
Reverse. Revert, or set
PY2HTTP_EXPOSE_ERRORS=1on a service that needs the old behaviour.Tests: 317 passed (including doctests); new tests for the default, expose, and OPAQUE-wins cases.