Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.retrip.crew.domain.vo.AnnouncementContent;
import com.retrip.crew.domain.vo.AnnouncementTitle;
import com.retrip.crew.domain.vo.NotificationBoardContent;
import jakarta.persistence.*;
import lombok.AccessLevel;
import lombok.Getter;
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

17 changes: 0 additions & 17 deletions src/main/java/com/retrip/crew/domain/exception/CrewErrorCode.java

This file was deleted.

10 changes: 0 additions & 10 deletions src/main/java/com/retrip/crew/domain/exception/CrewException.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.retrip.crew.domain.exception;

import com.retrip.crew.domain.exception.common.EntityNotFoundException;
import com.retrip.crew.domain.exception.common.ErrorCode;

public class CrewNotFoundException extends EntityNotFoundException {
private static final ErrorCode errorCode = ErrorCode.CREW_NOT_FOUND;

public CrewNotFoundException() {
super(errorCode);
}
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.retrip.crew.domain.exception.common;

import lombok.Getter;

@Getter
public class BusinessException extends RuntimeException {
private final ErrorCode errorCode;

public BusinessException(ErrorCode errorCode) {
super(errorCode.getMessage());
this.errorCode = errorCode;
}

public BusinessException(ErrorCode errorCode, String message) {
super(message);
this.errorCode = errorCode;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.retrip.crew.domain.exception.common;

public class EntityNotFoundException extends BusinessException {
private static final ErrorCode errorCode = ErrorCode.ENTITY_NOT_FOUND;
public EntityNotFoundException(ErrorCode errorCode) {
super(errorCode);
}

public EntityNotFoundException(String message) {
super(errorCode, message);
}

public EntityNotFoundException(ErrorCode errorCode, String message) {
super(errorCode, message);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.retrip.crew.domain.exception.common;

import lombok.Getter;
import org.springframework.http.HttpStatus;

import static org.springframework.http.HttpStatus.*;

@Getter
public enum ErrorCode {
SERVER_ERROR(INTERNAL_SERVER_ERROR, "Common-001", "Server error"),
INVALID_INPUT_VALUE(BAD_REQUEST, "Common-002", "Invalid input value"),
HANDLE_ACCESS_DENIED(FORBIDDEN, "Common-003", "Access is denied"),
ENTITY_NOT_FOUND(BAD_REQUEST, "Common-004", "Entity not found"),

CREW_NOT_FOUND(BAD_REQUEST, "Crew-001", "크루 엔티티를 찾을 수 없습니다.")
;

private final HttpStatus status;
private final String code;
private final String message;

ErrorCode(HttpStatus status, String code, String message) {
this.status = status;
this.code = code;
this.message = message;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.retrip.crew.domain.exception.common;

public class InvalidValueException extends BusinessException {
private static final ErrorCode errorCode = ErrorCode.INVALID_INPUT_VALUE;
public InvalidValueException(ErrorCode errorCode) {
super(errorCode);
}

public InvalidValueException(String message) {
super(errorCode, message);
}

public InvalidValueException(ErrorCode errorCode, String message) {
super(errorCode, message);
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.retrip.crew.domain.vo;

import com.retrip.crew.domain.exception.CrewDescriptionException;
import com.retrip.crew.domain.exception.common.InvalidValueException;
import jakarta.persistence.Column;
import jakarta.persistence.Embeddable;
import lombok.AccessLevel;
Expand All @@ -25,7 +25,7 @@ public AnnouncementContent(String value) {

private void validate(String value) {
if (value.length() > CONTENT_LENGTH_LIMIT) {
throw new CrewDescriptionException("공지 게시글 내용은 " + CONTENT_LENGTH_LIMIT + "자를 넘을 수 없습니다.");
throw new InvalidValueException("공지 게시글 내용은 " + CONTENT_LENGTH_LIMIT + "자를 넘을 수 없습니다.");
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.retrip.crew.domain.vo;

import com.retrip.crew.domain.exception.IntroductionTitleException;
import com.retrip.crew.domain.exception.common.InvalidValueException;
import jakarta.persistence.Column;
import jakarta.persistence.Embeddable;
import lombok.AccessLevel;
Expand All @@ -25,7 +25,7 @@ public AnnouncementTitle(String value) {

private void validate(String value) {
if (value.length() > TITLE_LENGTH_LIMIT) {
throw new IntroductionTitleException("공지 게시글 제목은 " + TITLE_LENGTH_LIMIT + "자를 넘을 수 없습니다.");
throw new InvalidValueException("공지 게시글 제목은 " + TITLE_LENGTH_LIMIT + "자를 넘을 수 없습니다.");
}
}
}
4 changes: 2 additions & 2 deletions src/main/java/com/retrip/crew/domain/vo/CrewDescription.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.retrip.crew.domain.vo;

import com.retrip.crew.domain.exception.CrewDescriptionException;
import com.retrip.crew.domain.exception.common.InvalidValueException;
import jakarta.persistence.Column;
import jakarta.persistence.Embeddable;
import lombok.AccessLevel;
Expand All @@ -25,7 +25,7 @@ public CrewDescription(String value) {

private void validate(String value) {
if (value.length() > DESCRIPTION_LENGTH_LIMIT) {
throw new CrewDescriptionException("크루 상세 설명은 " + DESCRIPTION_LENGTH_LIMIT + "자를 넘을 수 없습니다.");
throw new InvalidValueException("크루 상세 설명은 " + DESCRIPTION_LENGTH_LIMIT + "자를 넘을 수 없습니다.");
}
}
}
4 changes: 2 additions & 2 deletions src/main/java/com/retrip/crew/domain/vo/CrewTitle.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.retrip.crew.domain.vo;

import com.retrip.crew.domain.exception.CrewTitleException;
import com.retrip.crew.domain.exception.common.InvalidValueException;
import jakarta.persistence.Column;
import jakarta.persistence.Embeddable;
import lombok.AccessLevel;
Expand All @@ -25,7 +25,7 @@ public CrewTitle(String value) {

private void validate(String value) {
if (value.length() > TITLE_LENGTH_LIMIT) {
throw new CrewTitleException("크루 제목은 " + TITLE_LENGTH_LIMIT + "자를 넘을 수 없습니다.");
throw new InvalidValueException("크루 제목은 " + TITLE_LENGTH_LIMIT + "자를 넘을 수 없습니다.");
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.retrip.crew.domain.vo;

import com.retrip.crew.domain.exception.CrewDescriptionException;
import com.retrip.crew.domain.exception.common.InvalidValueException;
import jakarta.persistence.Column;
import jakarta.persistence.Embeddable;
import lombok.AccessLevel;
Expand All @@ -25,7 +25,7 @@ public IntroductionContent(String value) {

private void validate(String value) {
if (value.length() > CONTENT_LENGTH_LIMIT) {
throw new CrewDescriptionException("자기 소개 게시글 내용은 " + CONTENT_LENGTH_LIMIT + "자를 넘을 수 없습니다.");
throw new InvalidValueException("자기 소개 게시글 내용은 " + CONTENT_LENGTH_LIMIT + "자를 넘을 수 없습니다.");
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.retrip.crew.domain.vo;

import com.retrip.crew.domain.exception.CrewTitleException;
import com.retrip.crew.domain.exception.IntroductionTitleException;
import com.retrip.crew.domain.exception.common.InvalidValueException;
import jakarta.persistence.Column;
import jakarta.persistence.Embeddable;
import lombok.AccessLevel;
Expand All @@ -26,7 +25,7 @@ public IntroductionTitle(String value) {

private void validate(String value) {
if (value.length() > TITLE_LENGTH_LIMIT) {
throw new IntroductionTitleException("자기 소개 게시글 제목은 " + TITLE_LENGTH_LIMIT + "자를 넘을 수 없습니다.");
throw new InvalidValueException("자기 소개 게시글 제목은 " + TITLE_LENGTH_LIMIT + "자를 넘을 수 없습니다.");
}
}
}

This file was deleted.

4 changes: 2 additions & 2 deletions src/main/java/com/retrip/crew/domain/vo/PostContent.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.retrip.crew.domain.vo;

import com.retrip.crew.domain.exception.CrewDescriptionException;
import com.retrip.crew.domain.exception.common.InvalidValueException;
import jakarta.persistence.Column;
import jakarta.persistence.Embeddable;
import lombok.AccessLevel;
Expand All @@ -25,7 +25,7 @@ public PostContent(String value) {

private void validate(String value) {
if (value.length() > CONTENT_LENGTH_LIMIT) {
throw new CrewDescriptionException("자유 게시판 내용은 " + CONTENT_LENGTH_LIMIT + "자를 넘을 수 없습니다.");
throw new InvalidValueException("자유 게시판 내용은 " + CONTENT_LENGTH_LIMIT + "자를 넘을 수 없습니다.");
}
}
}
4 changes: 2 additions & 2 deletions src/main/java/com/retrip/crew/domain/vo/PostTitle.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.retrip.crew.domain.vo;

import com.retrip.crew.domain.exception.IntroductionTitleException;
import com.retrip.crew.domain.exception.common.InvalidValueException;
import jakarta.persistence.Column;
import jakarta.persistence.Embeddable;
import lombok.AccessLevel;
Expand All @@ -25,7 +25,7 @@ public PostTitle(String value) {

private void validate(String value) {
if (value.length() > TITLE_LENGTH_LIMIT) {
throw new IntroductionTitleException("자유 게시판 제목은 " + TITLE_LENGTH_LIMIT + "자를 넘을 수 없습니다.");
throw new InvalidValueException("자유 게시판 제목은 " + TITLE_LENGTH_LIMIT + "자를 넘을 수 없습니다.");
}
}
}
Loading