|
4 | 4 | import com.mbtips.common.exception.enums.CommonException; |
5 | 5 | import com.mbtips.common.response.ApiResponse; |
6 | 6 | import lombok.extern.slf4j.Slf4j; |
| 7 | +import org.springframework.http.ResponseEntity; |
7 | 8 | import org.springframework.validation.FieldError; |
8 | 9 | import org.springframework.web.bind.MethodArgumentNotValidException; |
9 | 10 | import org.springframework.web.bind.annotation.ExceptionHandler; |
|
17 | 18 | public class GlobalExceptionHandler { |
18 | 19 |
|
19 | 20 | @ExceptionHandler(CustomException.class) |
20 | | - public ApiResponse<Void> customExceptionHandler(CustomException e) { |
| 21 | + public ResponseEntity<Void> customExceptionHandler(CustomException e) { |
21 | 22 | log.error("### CustomExceptionHandler : {}", e.getMessage(), e); |
22 | | - return ApiResponse.fail(e.getException()); |
| 23 | + return ResponseEntity.internalServerError().build(); |
23 | 24 | } |
24 | 25 |
|
25 | 26 | @ExceptionHandler(IllegalArgumentException.class) |
26 | | - public ApiResponse<Void> exceptionHandler(IllegalArgumentException e) { |
| 27 | + public ResponseEntity<Void> exceptionHandler(IllegalArgumentException e) { |
27 | 28 | log.error("### IllegalArgumentExceptionHandler : {}", e.getMessage(), e); |
28 | | - return ApiResponse.fail(CommonException.INVALID_REQUEST_ERROR); |
| 29 | + return ResponseEntity.badRequest().build(); |
29 | 30 | } |
30 | 31 |
|
31 | 32 | @ExceptionHandler(Exception.class) |
32 | | - public ApiResponse<Void> exceptionHandler(Exception e) { |
| 33 | + public ResponseEntity<Void> exceptionHandler(Exception e) { |
33 | 34 | log.error("### ExceptionHandler : {}", e.getMessage(), e); |
34 | | - return ApiResponse.fail(CommonException.INTERNAL_SERVER_ERROR); |
| 35 | + return ResponseEntity.internalServerError().build(); |
35 | 36 | } |
36 | 37 |
|
37 | 38 | /** |
|
0 commit comments