Repository navigation
Conversation
It makes sense to want the default setup to cover 500-range responses.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #109 +/- ##
=======================================
Coverage 96.59% 96.59%
=======================================
Files 11 11
Lines 440 440
=======================================
Hits 425 425
Misses 15 15 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
My point about the type [ref] is that if we use this pattern, the app stops being a FastAPI instance.
This is ultimately user choice, since it's only a documentation change, but it may introduce lots of squigglies in code.
You can cast it with typing.cast, but that's a bit hacky.
Maybe we need to move from a dataclass to a normal class and use some typing magic, or add a from_app classmethod whose typehint is still FasAPI, or look into using the post_init to auto register the handler for errors, or something.
It definitely results in squigglies when it comes to trying to access the test_client in pytest --
|
|
I both think:
Do you reckon there's a way to satisfy both of these, or is it a hard trade-off? |
|
FastAPI's docs include support for an exception handler: And, it's possible to override the default exception handlers I'm guessing the right way to go about this is to also add an exception handler that generates or repeats the correlation-id from the request headers into the logs and/or response? |
It makes sense to want the default setup to cover 500-range responses.