Skip to content

Commit

Permalink
feat: Errorcode, GlobalExceptionHandler 수정 (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyeong-hyeok committed Aug 1, 2023
1 parent a087f5e commit 8c5ebd2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/main/java/com/project/mapdagu/error/ErrorCode.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
@RequiredArgsConstructor
public enum ErrorCode {

TOKEN_NOT_EXIST(NOT_FOUND, "토큰이 존재하지 않습니다.");
TOKEN_NOT_EXIST(NOT_FOUND, "토큰이 존재하지 않습니다."),

ALREADY_EXIST_EMAIL(BAD_REQUEST, "이미 존재하는 이메일입니다."),
ALREADY_EXIST_USERNAME(BAD_REQUEST, "이미 존재하는 사용자 이름입니다.");

private final int code;
private final String message;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ public class GlobalExceptionHandler {
@ExceptionHandler
public ResponseEntity<ErrorResponse> handle(final BusinessException e) {
log.info("businessException: {}", e);
return ResponseEntity.badRequest().body(ErrorResponse.of(e.getCode(), e.getMessage()));
return ResponseEntity.status(e.getCode()).body(ErrorResponse.of(e.getCode(), e.getMessage()));
}
}

0 comments on commit 8c5ebd2

Please sign in to comment.