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

ResponseStatusException does not use the reason to set the "detail" field #29567

Closed
ydemartino opened this issue Nov 24, 2022 · 1 comment
Closed
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: bug A general bug
Milestone

Comments

@ydemartino
Copy link

Affects: 6.0

The javadoc for the ResponseStatusException is

 * Subclass of {@link ErrorResponseException} that accepts a "reason" and maps
 * it to the "detail" property of {@link org.springframework.http.ProblemDetail}.

But when I set a reason, the detail is always null. It seems the class is missing getBody().setDetail(getReason());.
Or maybe this is an issue in the javadoc?
Or am I missing something?


@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Nov 24, 2022
@rstoyanchev rstoyanchev self-assigned this Nov 24, 2022
@rstoyanchev rstoyanchev added in: web Issues in web modules (web, webmvc, webflux, websocket) type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Nov 24, 2022
@rstoyanchev rstoyanchev added this to the 6.0.2 milestone Nov 24, 2022
@rstoyanchev
Copy link
Contributor

This was the case, but was removed when adding tests for all sub-classes, with the idea that the reason isn't always what should be present to the outside world.

What I think it should say, and work, is that it uses the reason as the detail by default, but sub-classes can set the detail to something else if needed.

@snicoll snicoll modified the milestones: 6.0.2, 6.0.3 Nov 24, 2022
@jhoeller jhoeller modified the milestones: 6.0.3, 6.0.2 Nov 24, 2022
@rstoyanchev rstoyanchev changed the title ResponseStatusException not working correctly ResponseStatusException does not use the reason to set the "detail" field Nov 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: bug A general bug
Projects
None yet
Development

No branches or pull requests

5 participants