-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat : 전역적 예외처리 로직 생성 및 Success,ErrorResponse 리팩토링 #14
Conversation
(CC-114)
(CC-114)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
컨벤션 관련해서만 고쳐주시면 될 것 같아요.
public class HealthTestController { | ||
@GetMapping("/api/health") | ||
public ResponseEntity<SuccessResponse<String>> healthTest() { | ||
return ResponseEntity.ok(new SuccessResponse<>(1000,"api health test에 성공했습니다.","health test v1")); | ||
return SuccessResponse.of(SuccessCode.OK,"Caecae Spring Server Health Test ~!"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
,와 "사이에 공백 넣어주세요
public class ErrorResponse extends BaseResponse { | ||
|
||
private ErrorResponse(ErrorCode errorCode) { | ||
super(errorCode.getResponseCode(),errorCode.getMessage()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
,와 "사이에 공백 넣어주세요
*/ | ||
@Getter | ||
@AllArgsConstructor(access = AccessLevel.PROTECTED) | ||
public enum ErrorCode implements BaseCode{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BaseCode와 { 사이에 공백 넣어주세요.
/** | ||
* 1000 : 틀린그림찾기 | ||
*/ | ||
NOT_FOUND(1000, "잘못된 요청입니다.",HttpStatus.NOT_FOUND), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
,와 "사이에 공백 넣어주세요
/** | ||
* 2xxx : 레이싱게임 .. | ||
*/ | ||
NEED_AUTHENICATE(1000, "권한이 필요한 요청입니다,",HttpStatus.UNAUTHORIZED), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
,와 "사이에 공백 넣어주세요
*/ | ||
@Getter | ||
@AllArgsConstructor(access = AccessLevel.PROTECTED) | ||
public enum SuccessCode implements BaseCode{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BaseCode와 { 사이에 공백 넣어주세요.
/** | ||
* 1000 : 틀린그림찾기 | ||
*/ | ||
OK(1000, "요청이 성공했습니다.",HttpStatus.OK), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
,와 "사이에 공백 넣어주세요
CREATED(1001,"생성 요청이 성공했습니다.",HttpStatus.CREATED), | ||
USER_CREATED(1001,"유저 회원가입이 성공했습니다.",HttpStatus.CREATED), | ||
TEAM_CREATED(1001,"팀 등록에 성공했습니다.",HttpStatus.CREATED); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
,와 "사이에 공백 넣어주세요
super(errorCode.getMessage()); | ||
this.errorCode = errorCode; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
불필요한 라인은 제거해주세요.
super(errorCode.getMessage()); | ||
this.errorCode = errorCode; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
불필요한 라인은 제거해주세요.
(CC-114)
…#13) * test : 서버 health check 컨트롤러 테스트 코드 작성 (CC-111) * test : 서버 health check 컨트롤러 테스트 코드 작성 (CC-111) * test : 서버 health check 컨트롤러 테스트 코드 작성 (CC-111) * feat : S3 컨트롤러에 responseEntity 설정 (CC-111) * test : S3 통합테스트 환경 disabled (CC-111) * docs : Pull Request template 업로드 (CC-111) * rename : S3 controller 디렉터리 수정 (CC-111)
(CC-114)
(CC-114)
(CC-114)
(CC-114)
개발 내용
RacingGameWinner
테이블의rank
컬럼이 예약어여서 임시로ranking
으로 수정BaseCode
,SuccessCode
,ErrorCode
에서 관리BaseResponse
,SuccessResponse
,ErrorResponse
클래스에서 관리GlobalException
에서 발생시킴.GlobalExceptionHandler
에서 발생한 에러를 캐치하여ErrorResponse
로 반환{Domain}Exception
과{Domain}ExceptionHandler
를 생성하여 도메인 별로 에러를 관리할 것