File tree Expand file tree Collapse file tree 3 files changed +28
-4
lines changed
backend/src/main/java/com/park/utmstack Expand file tree Collapse file tree 3 files changed +28
-4
lines changed Original file line number Diff line number Diff line change @@ -66,6 +66,11 @@ public ResponseEntity<?> handleMethodArgumentNotValid(MethodArgumentNotValidExce
6666 return ResponseUtil .buildBadRequestResponse (e .getBindingResult ().getAllErrors ().get (0 ).getDefaultMessage ());
6767 }
6868
69+ @ ExceptionHandler (ApiException .class )
70+ public ResponseEntity <?> handleApiException (ApiException ex ) {
71+ return ResponseUtil .buildErrorResponse (ex .getStatus (), ex .getMessage ());
72+ }
73+
6974 @ ExceptionHandler (Exception .class )
7075 public ResponseEntity <?> handleGenericException (Exception e , HttpServletRequest request ) {
7176 return ResponseUtil .buildInternalServerErrorResponse (e .getMessage ());
Original file line number Diff line number Diff line change 11package com .park .utmstack .aop .logging ;
22
3- import java .lang .annotation .ElementType ;
4- import java .lang .annotation .Retention ;
5- import java .lang .annotation .RetentionPolicy ;
6- import java .lang .annotation .Target ;
3+ import java .lang .annotation .*;
74
5+ @ Inherited
86@ Target (ElementType .TYPE )
97@ Retention (RetentionPolicy .RUNTIME )
108public @interface NoLogException {}
Original file line number Diff line number Diff line change 1+ package com .park .utmstack .util .exceptions ;
2+
3+ import com .park .utmstack .aop .logging .NoLogException ;
4+ import lombok .Getter ;
5+ import lombok .Setter ;
6+ import org .springframework .http .HttpStatus ;
7+
8+ @ Getter
9+ @ Setter
10+ @ NoLogException
11+ public class ApiException extends RuntimeException {
12+ private final String message ;
13+ private final HttpStatus status ;
14+
15+ public ApiException (String message , HttpStatus status ) {
16+ super (message );
17+ this .message = message ;
18+ this .status = status ;
19+ }
20+ }
21+
You can’t perform that action at this time.
0 commit comments