File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
boot/src/main/java/com/reajason/javaweb/boot/api Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 11package com .reajason .javaweb .boot .api ;
22
3+ import com .reajason .javaweb .GenerationException ;
34import lombok .extern .slf4j .Slf4j ;
45import org .springframework .http .HttpStatus ;
56import org .springframework .http .ResponseEntity ;
@@ -22,10 +23,16 @@ public ResponseEntity<?> handleNoResourceException() {
2223 return ResponseEntity .status (HttpStatus .NOT_FOUND ).build ();
2324 }
2425
26+ @ ResponseStatus (HttpStatus .INTERNAL_SERVER_ERROR )
27+ @ ExceptionHandler (GenerationException .class )
28+ public ErrorResponse handleGenerationException (GenerationException exception ) {
29+ return new ErrorResponse (exception .getMessage ());
30+ }
31+
2532 @ ResponseStatus (HttpStatus .INTERNAL_SERVER_ERROR )
2633 @ ExceptionHandler (Throwable .class )
2734 public ErrorResponse handleThrowable (Throwable throwable ) {
28- log .error ("请求出错 " , throwable );
35+ log .error ("Internal Exception " , throwable );
2936 return new ErrorResponse (throwable .getMessage ());
3037 }
3138}
You can’t perform that action at this time.
0 commit comments