filemonczyk filemonczyk - 27 days ago 4
Java Question

Accessing the error object inside of exceptionhandler method

Is there any way to get inside to the exception object when using annotation @ExceptionHandler?

this is my code:

public ResponseEntity handleException(){
return ResponseEntity
.body("Entity contains null or forbidden values");

I'd like to have returned message to contain customized info about perticular fields. (That's why I need error object).


Pass in the exception

public ResponseEntity handleException(DataInputException exception) {