修改 DefaultExceptionHandler,防止其拦截其它异常。

pull/1/head
ZhouXY108 2022-12-11 02:34:28 +08:00
parent 2a8a185288
commit eb6d4fbbea
1 changed files with 5 additions and 1 deletions

View File

@ -55,7 +55,11 @@ public class DefaultExceptionHandler extends BaseExceptionHandler {
HttpStatus.BAD_REQUEST);
}
@ExceptionHandler(Exception.class)
@ExceptionHandler({
IllegalArgumentException.class,
DataAccessException.class,
MethodArgumentNotValidException.class
})
public ResponseEntity<RestfulResult> handleException(Exception e) {
log.error(e.getMessage(), e);
return buildExceptionResponse(e);