Skip to content

Commit

Permalink
feat($Exception): catch IllegalArgumentException
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnymillergh committed May 4, 2020
1 parent a091015 commit 3c5eb03
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ public ResponseBodyBean<Object> handleException(HttpServletRequest request,
log.error("[GlobalExceptionCapture]: Exception information: {} ", exception.getMessage());
response.setStatus(HttpStatus.INVALID_PARAM.getCode());
return ResponseBodyBean.ofStatus(HttpStatus.INVALID_PARAM);
} else if (exception instanceof IllegalArgumentException) {
log.error("[GlobalExceptionCapture]: Exception information: {} ", exception.getMessage());
response.setStatus(HttpStatus.BAD_REQUEST.getCode());
return ResponseBodyBean.ofStatus(HttpStatus.BAD_REQUEST.getCode(), exception.getMessage(), null);
}
log.error("[GlobalExceptionCapture]: Exception information: {} ", exception.getMessage(), exception);
response.setStatus(HttpStatus.ERROR.getCode());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ public ResponseBodyBean<Object> handleException(HttpServletRequest request,
log.error("[GlobalExceptionCapture]: Exception information: {} ", exception.getMessage());
response.setStatus(HttpStatus.INVALID_PARAM.getCode());
return ResponseBodyBean.ofStatus(HttpStatus.INVALID_PARAM);
} else if (exception instanceof IllegalArgumentException) {
log.error("[GlobalExceptionCapture]: Exception information: {} ", exception.getMessage());
response.setStatus(HttpStatus.BAD_REQUEST.getCode());
return ResponseBodyBean.ofStatus(HttpStatus.BAD_REQUEST.getCode(), exception.getMessage(), null);
}
log.error("[GlobalExceptionCapture]: Exception information: {} ", exception.getMessage(), exception);
response.setStatus(HttpStatus.ERROR.getCode());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ public ResponseBodyBean<Object> handleException(HttpServletRequest request,
log.error("[GlobalExceptionCapture]: Exception information: {} ", exception.getMessage());
response.setStatus(HttpStatus.INVALID_PARAM.getCode());
return ResponseBodyBean.ofStatus(HttpStatus.INVALID_PARAM);
} else if (exception instanceof IllegalArgumentException) {
log.error("[GlobalExceptionCapture]: Exception information: {} ", exception.getMessage());
response.setStatus(HttpStatus.BAD_REQUEST.getCode());
return ResponseBodyBean.ofStatus(HttpStatus.BAD_REQUEST.getCode(), exception.getMessage(), null);
}
log.error("[GlobalExceptionCapture]: Exception information: {} ", exception.getMessage(), exception);
response.setStatus(HttpStatus.ERROR.getCode());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ public ResponseBodyBean<Object> handleException(HttpServletRequest request,
log.error("[GlobalExceptionCapture]: Exception information: {} ", exception.getMessage());
response.setStatus(HttpStatus.INVALID_PARAM.getCode());
return ResponseBodyBean.ofStatus(HttpStatus.INVALID_PARAM);
} else if (exception instanceof IllegalArgumentException) {
log.error("[GlobalExceptionCapture]: Exception information: {} ", exception.getMessage());
response.setStatus(HttpStatus.BAD_REQUEST.getCode());
return ResponseBodyBean.ofStatus(HttpStatus.BAD_REQUEST.getCode(), exception.getMessage(), null);
}
log.error("[GlobalExceptionCapture]: Exception information: {} ", exception.getMessage(), exception);
response.setStatus(HttpStatus.ERROR.getCode());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ public ResponseBodyBean<Object> handleException(HttpServletRequest request,
log.error("[GlobalExceptionCapture]: Exception information: {} ", exception.getMessage());
response.setStatus(HttpStatus.INVALID_PARAM.getCode());
return ResponseBodyBean.ofStatus(HttpStatus.INVALID_PARAM);
} else if (exception instanceof IllegalArgumentException) {
log.error("[GlobalExceptionCapture]: Exception information: {} ", exception.getMessage());
response.setStatus(HttpStatus.BAD_REQUEST.getCode());
return ResponseBodyBean.ofStatus(HttpStatus.BAD_REQUEST.getCode(), exception.getMessage(), null);
}
log.error("[GlobalExceptionCapture]: Exception information: {} ", exception.getMessage(), exception);
response.setStatus(HttpStatus.ERROR.getCode());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ public ResponseBodyBean<Object> handleException(HttpServletRequest request,
log.error("[GlobalExceptionCapture]: Exception information: {} ", exception.getMessage());
response.setStatus(HttpStatus.INVALID_PARAM.getCode());
return ResponseBodyBean.ofStatus(HttpStatus.INVALID_PARAM);
} else if (exception instanceof IllegalArgumentException) {
log.error("[GlobalExceptionCapture]: Exception information: {} ", exception.getMessage());
response.setStatus(HttpStatus.BAD_REQUEST.getCode());
return ResponseBodyBean.ofStatus(HttpStatus.BAD_REQUEST.getCode(), exception.getMessage(), null);
}
log.error("[GlobalExceptionCapture]: Exception information: {} ", exception.getMessage(), exception);
response.setStatus(HttpStatus.ERROR.getCode());
Expand Down

0 comments on commit 3c5eb03

Please sign in to comment.