-
-
Notifications
You must be signed in to change notification settings - Fork 390
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
feat: problem details plugin #3323
Conversation
It looks like you are adding a new feature! 🚀 Please rebase and point your PR to the |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3323 +/- ##
=======================================
Coverage 98.28% 98.28%
=======================================
Files 329 330 +1
Lines 14973 15032 +59
Branches 2383 2392 +9
=======================================
+ Hits 14716 14774 +58
Misses 116 116
- Partials 141 142 +1 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. This looks useful. LGTM
What is the status on this? |
At risk of stating the obvious, it looks like its waiting on some comments to be resolved and a rebase. |
I'll get it fixed in a few days. I've been a bit busy. |
69f34bd
to
6460f0a
Compare
Quality Gate passedIssues Measures |
This is tagged for 2.9.0 but 2.9.0 was just released. I think the milestone needs to be updated. |
This is tagged for v2.10.0 but it just came out and it did not contain this at all. |
dang.. sorry about this @bunny-therapist - yeah it needed to be merged to be included - perhaps @Alc-Alc had a reason for not merging ready PRs before? @litestar-org/maintainers |
…on from HTTPException
If `extra` is a `Mapping` then we'll merge that into the final problem details JSON to keep it similar to how it is in the RFC.
Co-authored-by: Jacob Coffee <[email protected]>
b8e9d58
to
a81176f
Compare
Quality Gate passedIssues Measures |
Documentation preview will be available shortly at https://litestar-org.github.io/litestar-docs-preview/3323 |
Description
A plugin to enable usage of problem details as the response.
The way this works is by injecting an exception handler into the app level exception handlers to convert
ProblemDetailsException
into a response following the specification as per RFC 9457.Users can pass in a mapping of exception types to callables that will convert those exception types into
ProblemDetailsException
for handling specific exceptions such as pydantic'sValidationError
. That convertedProblemDetailsException
will then be used to create the response. This should allow for flexibility when needed.Closes
Closes #3199.