Skip to content

Commit

Permalink
refactor: ErrorCode의 이름을 Response 내에서 처리하도록 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
Sangwook02 committed Feb 11, 2024
1 parent 746b3f2 commit 5120ace
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ public static ErrorResponse of(ErrorCode errorCode) {
return new ErrorResponse(errorCode.name(), errorCode.getMessage());
}

public static ErrorResponse of(String errorCodeName, String errorMessage) {
return new ErrorResponse(errorCodeName, errorMessage);
public static ErrorResponse of(ErrorCode errorCode, String errorMessage) {
return new ErrorResponse(errorCode.name(), errorMessage);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ protected ResponseEntity<Object> handleMethodArgumentNotValid(
log.error("METHOD_ARGUMENT_NOT_VALID : {}", e.getMessage(), e);
String errorMessage = e.getBindingResult().getAllErrors().get(0).getDefaultMessage();
return ResponseEntity.status(status.value())
.body(ErrorResponse.of(ErrorCode.METHOD_ARGUMENT_NOT_VALID.name(), errorMessage));
.body(ErrorResponse.of(ErrorCode.METHOD_ARGUMENT_NOT_VALID, errorMessage));
}
}

0 comments on commit 5120ace

Please sign in to comment.