errors/2 advices - #94
Merged
Merged
Conversation
JosteinGj
added this pull request to stack #99
September 15, 2026 09:17
olavgg
force-pushed
the
errors/2-advices
branch
from
September 15, 2026 13:26
c420440 to
f337d93
Compare
JosteinGj
force-pushed
the
errors/2-advices
branch
from
September 16, 2026 07:40
f337d93 to
bd9be39
Compare
JosteinGj
marked this pull request as ready for review
September 16, 2026 07:50
Converts the two wrapper-shaped advices and adds the three that were missing. Controllers still catch most of these locally, so their bodies are unchanged until the next commit removes those catches. BadRequestExceptionHandler and ConcurrencyExceptionHandler now return ProblemDetail. The former's javadoc argued against exactly this, and the argument was sound as stated: controllers catch BadRequestException locally and return the wrapper, so converting the advice alone gives one exception two shapes. That is an argument against changing it in isolation, not against the shape — the local catches go in the same change. ConflictError.cause = "concurrency" becomes the type .../errors/optimistic-lock. It existed so clients could discriminate without string-matching the message, which is what RFC 9457's type member is for. Three new advices. ConstraintViolationException had none, so seventeen controllers caught it themselves — twenty-six blocks calling BuildErrorResponse, which returns a DataWrapper: a success-shaped envelope used as an error body. DuplicateDataException had none, so fourteen controllers read the status out of the payload with HttpStatusCode.valueOf(error.getCode()). MethodArgumentNotValid had none, which is why adding @Valid to the thirty-six unvalidated bodies was held: without a handler it would have introduced a fourth shape rather than removing shapes. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: jgjesdal <jostein@intellistream.ai>
JosteinGj
force-pushed
the
errors/2-advices
branch
from
September 16, 2026 07:50
bd9be39 to
658af48
Compare
olavgg
approved these changes
Sep 16, 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.
What this changes
How it was verified
Checklist
git commit -s), per CONTRIBUTING.md./gradlew buildpasses(see AGENTS.md for which of the two documentation sites it belongs in)