Repository navigation
Log status 500 for a request whose handler raised - #55
Merged
thomas-samoht merged 3 commits intoNov 10, 2026
Merged
thomas-samoht merged 3 commits into
thomas-samoht merged 3 commits into
Conversation
thomas-samoht
added a commit
that referenced
this pull request
Nov 9, 2026
ricklambrechts
previously approved these changes
Nov 9, 2026
thomas-samoht
force-pushed
the
fix/access-status-500-on-crash
branch
from
November 9, 2026 15:57
e9df736 to
81d30bd
Compare
thomas-samoht
changed the base branch from
main
to
feat/replace-update-context-with-set-context
November 9, 2026 15:57
thomas-samoht
force-pushed
the
fix/access-status-500-on-crash
branch
9 times, most recently
from
November 10, 2026 09:19
6d00f82 to
8269ec5
Compare
ricklambrechts
previously approved these changes
Nov 10, 2026
Problem: when the handler raised, call_next() raised too and the access record was logged with status_code null. The client still received an answer, the 500 that Starlette's ServerErrorMiddleware sends for an unhandled exception, but the access record did not say so. Anything counting server errors on the app stream missed exactly the requests that crashed. Fix: the access record carries 500 when there is no response. The middleware is meant to be added last, so ServerErrorMiddleware is the only layer outside it, and that is the status it sends. An exception handler registered for Exception may answer with another status, which the middleware cannot see, as the exception leaves it before the handler runs. The test that pinned null now expects the 500 the client gets.
thomas-samoht
force-pushed
the
fix/access-status-500-on-crash
branch
from
November 10, 2026 09:24
8269ec5 to
72225ae
Compare
ricklambrechts
approved these changes
Nov 10, 2026
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.
No description provided.