Skip to content

Commit

Permalink
Docs: 중복 회원가입 예외 처리 (#92)
Browse files Browse the repository at this point in the history
* Docs: 중복 회원가입 예외 처리

* Docs: SignUpException 생성
  • Loading branch information
hyukjinKimm authored Jul 17, 2024
1 parent 8d0f61c commit 794d32b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public enum ErrorType {
WRONG_SIGNATURE_TOKEN(HttpStatus.UNAUTHORIZED.value(), "Signature가 잘못된 Token입니다."),
INTERNAL_SERVER_ERROR(HttpStatus.INTERNAL_SERVER_ERROR.value(), "서버 오류"),
INVALID_PLATFORM_TYPE(HttpStatus.INTERNAL_SERVER_ERROR.value(), "지원하지 않는 로그인 플랫폼입니다."),
DUPLICATED_USER_ERROR(HttpStatus.INTERNAL_SERVER_ERROR.value(), "이미 가입된 유저입니다."),
DUPLICATED_USER_ERROR(HttpStatus.BAD_REQUEST.value(), "이미 가입된 유저입니다."),
NOTFOUND_USER_ERROR(HttpStatus.NOT_FOUND.value(), "존재하지 않는 유저 입니다."),
UNABLE_TO_CREATE_APPLE_PUBLIC_KEY(HttpStatus.UNAUTHORIZED.value(), "애플 로그인 중 퍼블릭 키 생성에 문제가 발생했습니다."),
/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
package com.donkeys_today.server.support.exception;

import com.donkeys_today.server.support.dto.ApiResponse;
import com.donkeys_today.server.support.exception.auth.SignUpException;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalExceptionAdvice {

@ExceptionHandler(SignUpException.class)
protected ResponseEntity<ApiResponse> SignUpException(SignUpException e) {
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(ApiResponse.error(e.getErrorType()));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.donkeys_today.server.support.exception.auth;

import com.donkeys_today.server.support.dto.type.ErrorType;
import com.donkeys_today.server.support.exception.BusinessException;
import lombok.Getter;

public class SignUpException extends BusinessException {

public SignUpException(ErrorType errorType) {
super(errorType);
}
}

0 comments on commit 794d32b

Please sign in to comment.