@@ -17,7 +17,7 @@ public class GlobalExceptionHandler {
1717 @ ExceptionHandler (Exception .class )
1818 public ResponseEntity <ApiResponse <Object >> handleCommonException (Exception exception ) {
1919 log .error (exception .getMessage (), exception );
20- ErrorCode errorCode = ErrorCode .INTERNAL_SERVER_ERROR ;
20+ CommonErrorCode errorCode = CommonErrorCode .INTERNAL_SERVER_ERROR ;
2121
2222 ApiResponse <Object > response = new ApiResponse <>(
2323 false ,
@@ -32,7 +32,7 @@ public ResponseEntity<ApiResponse<Object>> handleCommonException(Exception excep
3232 @ ExceptionHandler (BusinessException .class )
3333 public ResponseEntity <ApiResponse <Object >> handleBusinessException (BusinessException exception ) {
3434 log .warn ("code={}, message={}" , exception .getErrorCode (), exception .getMessage ());
35- ErrorCode errorCode = exception .getErrorCode ();
35+ BaseErrorCode errorCode = exception .getErrorCode ();
3636 HttpStatus status = errorCode .getHttpStatus ();
3737 String message = exception .getMessage ();
3838 Object data = exception .getData ();
@@ -50,7 +50,6 @@ public ResponseEntity<ApiResponse<Object>> handleBusinessException(BusinessExcep
5050 @ ExceptionHandler (MethodArgumentNotValidException .class )
5151 public ResponseEntity <ApiResponse <Object >> handleMethodArgumentNotValidException (MethodArgumentNotValidException exception ) {
5252 log .warn ("Validation 실패: {}" , exception .getBindingResult ().getFieldErrors ());
53- ErrorCode errorCode = ErrorCode .VALIDATION_ERROR ;
5453
5554 // 필드별 에러 메시지 추가
5655 Map <String , String > errorMessage = new HashMap <>();
@@ -60,11 +59,11 @@ public ResponseEntity<ApiResponse<Object>> handleMethodArgumentNotValidException
6059
6160 ApiResponse <Object > response = new ApiResponse <>(
6261 false ,
63- errorCode .name (),
64- errorCode . getMessage () ,
62+ HttpStatus . BAD_REQUEST .name (),
63+ "유효성 검증에 실패했습니다." ,
6564 errorMessage
6665 );
6766
68- return ResponseEntity .status (errorCode . getHttpStatus () ).body (response );
67+ return ResponseEntity .status (HttpStatus . BAD_REQUEST ).body (response );
6968 }
7069}
0 commit comments