Don't return exception message in ControllerAdvice
This commit is contained in:
@ -18,7 +18,7 @@ public class ControllerAdvice {
|
|||||||
@ExceptionHandler(value = {RuntimeException.class})
|
@ExceptionHandler(value = {RuntimeException.class})
|
||||||
public ResponseEntity<ErrorResponse> handleRuntimeException(Exception e) {
|
public ResponseEntity<ErrorResponse> handleRuntimeException(Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
var response = new ErrorResponse(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR.value());
|
var response = new ErrorResponse("An internal error occurred", HttpStatus.INTERNAL_SERVER_ERROR.value());
|
||||||
return new ResponseEntity<>(response, HttpStatus.INTERNAL_SERVER_ERROR);
|
return new ResponseEntity<>(response, HttpStatus.INTERNAL_SERVER_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user