Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Nu har jag typ provat med
- @RestControllerAdvice
- public class ExceptionHandler extends ResponseEntityExceptionHandler {
- @Override
- protected ResponseEntity<Object> handleExceptionInternal(java.lang.Exception e, Object body, HttpHeaders headers, HttpStatus status, WebRequest request) {
- if (e instanceof HttpMessageNotReadableException && e.getCause() instanceof JsonParseException) {
- return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY).build();
- }
- return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(handleAll(e));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement