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

Support Problem Details for HTTP APIs RFC7807 #3552

Merged
merged 7 commits into from
Oct 5, 2024

Conversation

kliushnichenko
Copy link
Contributor

This PR introduces:

  1. HttpProblem class that represents the model of RFC7807 problem details.
    It extends RuntimeException so it can be naturally thrown.
    It also provides handy static methods to instantiate a problem and a builder to make a fully packed instance.

  2. ProblemDetailsErrorHandler a global error handler aimed to make anything thrown from the app compliant with RFC7807.
    It also contains special handling for some built-in exceptions to make the response more informative.
    It always logs server errors(5xx) and can optionally log client errors (4xx) unless they are fully muted

I'm going to align our ValidationResult with RFC7807 in a separate PR. That's why both classes were placed in the core package nevertheless it may seem odd at the moment.

If there are no critical comments I'll proceed to the documentation part.

@jknack pls take a look when you have a spare time

@jknack jknack added this to the 3.4.2 milestone Oct 5, 2024
@jknack jknack merged commit 4e90e34 into jooby-project:3.x Oct 5, 2024
1 check passed
@jknack
Copy link
Member

jknack commented Oct 5, 2024

now I merged it, but sure if there was more work coming??

@kliushnichenko
Copy link
Contributor Author

yeah, documentation here #3555.
ValidationResult support a bit later

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants