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

Handle non-Exception BaseExceptions #43

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

JohnnyDeuss
Copy link

BaseExceptions that are not a subclass of Exception break the middleware, resulting in a KeyError. Starlette and FastAPI don't handle these in their ServerErrorMiddleware, either, so I think setting the status to None is reasonable. Another option would be to ignore these cases or log something different.

Fixes #42.

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.

The middleware produces "KeyError: 'status'" sometimes.
1 participant