Skip to content

Commit d10ac94

Browse files
committed
@ExceptionHandler BaseUnCheckException
1 parent d877b48 commit d10ac94

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

core/src/main/java/lazy/fast/code/core/exception/GlobalRestExceptionHandler.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,4 +125,10 @@ public ResponseEntity<ResultMsg> exceptionHandler(Exception e) {
125125
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(ResultMsg.error());
126126
}
127127

128+
@ExceptionHandler(value = BaseUnCheckException.class)
129+
public ResponseEntity<ResultMsg> baseUnCheckHandler(BaseUnCheckException e) {
130+
// 其它继承BaseUnCheckException的自定义非受检异常的处理方式
131+
return ResponseEntity.status(e.getResultMsg().getCode()).body(e.getResultMsg());
132+
}
133+
128134
}

0 commit comments

Comments
 (0)