Skip to content

Commit

Permalink
FIX: (#145) 리뷰 도메인 예외 계층을 추가한다
Browse files Browse the repository at this point in the history
  • Loading branch information
anxi01 committed Feb 20, 2025
1 parent 943d210 commit 96f3763
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/main/java/com/zerozero/review/exception/ReviewErrorType.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.zerozero.review.exception;

import com.zerozero.core.support.error.ErrorType;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;

@Getter
@RequiredArgsConstructor
public enum ReviewErrorType implements ErrorType {
NOT_EXIST_DELETABLE_REVIEW(HttpStatus.BAD_REQUEST, "삭제 가능한 리뷰가 존재하지 않습니다."),
USER_VALIDATION_FAILED(HttpStatus.INTERNAL_SERVER_ERROR, "리뷰를 작성한 사용자가 아닙니다."),
ALREADY_USER_REVIEWED(HttpStatus.INTERNAL_SERVER_ERROR, "이미 리뷰를 작성한 사용자입니다."),
NOT_EXIST_REVIEW(HttpStatus.BAD_REQUEST, "리뷰가 존재하지 않습니다."),
;

private final HttpStatus status;

private final String message;
}
15 changes: 15 additions & 0 deletions src/main/java/com/zerozero/review/exception/ReviewException.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.zerozero.review.exception;

import com.zerozero.core.support.error.CoreException;
import com.zerozero.core.support.error.ErrorType;

public class ReviewException extends CoreException {

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

public ReviewException(ErrorType errorType, Object data) {
super(errorType, data);
}
}

0 comments on commit 96f3763

Please sign in to comment.