I have an issue displaying an error message at the moment that a bad request is triggered.
@DeleteMapping("/{projectId}/bugs/{bugId}")
public void deleteBug(@PathVariable (value = "projectId") Long projectId,
@PathVariable (value = "bugId") Long bugId){
if (!projectService.existById(projectId) || !bugService.existById(bugId)) {
throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "ProjectId " + projectId + " or BugId " + bugId + " not found");
}
bugService.deleteBug(bugId);
}
This is the JSON response when I trigger the Response:
{
"timestamp": "2020-05-29T15:40:41.302+00:00",
"status": 400,
"error": "Bad Request",
"message": "",
"path": "/projects/3/bugs/2" }
As you can see the message is not appearing. If I change the HttpStatus in the code it actually works but for some reason, the message is not working.
I checked the constructor of the class and it actually allows only the status and the reason.
Am I missing something or is it a bug in the ResponseStatusException class?
2.2.6.RELEASE. I have the same problem with version2.3.0.RELEASE, which is the newest by the time of this comment. Everything is good with the previous ones.