diff --git a/src/main/java/com/prgrms/catchtable/common/exception/CommonException.java b/src/main/java/com/prgrms/catchtable/common/exception/CommonException.java new file mode 100644 index 00000000..9004b306 --- /dev/null +++ b/src/main/java/com/prgrms/catchtable/common/exception/CommonException.java @@ -0,0 +1,11 @@ +package com.prgrms.catchtable.common.exception; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public class CommonException extends RuntimeException { + + private final ErrorCode errorCode; +} diff --git a/src/main/java/com/prgrms/catchtable/common/exception/ErrorCode.java b/src/main/java/com/prgrms/catchtable/common/exception/ErrorCode.java new file mode 100644 index 00000000..876f8b79 --- /dev/null +++ b/src/main/java/com/prgrms/catchtable/common/exception/ErrorCode.java @@ -0,0 +1,12 @@ +package com.prgrms.catchtable.common.exception; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public enum ErrorCode { + NOT_EXIST_MEMBER("존재하지 않는 아이디입니다."); + + private final String message; +} diff --git a/src/main/java/com/prgrms/catchtable/common/exception/ExceptionHandler.java b/src/main/java/com/prgrms/catchtable/common/exception/ExceptionHandler.java new file mode 100644 index 00000000..e80e90fa --- /dev/null +++ b/src/main/java/com/prgrms/catchtable/common/exception/ExceptionHandler.java @@ -0,0 +1,8 @@ +package com.prgrms.catchtable.common.exception; + +import org.springframework.web.bind.annotation.RestControllerAdvice; + +@RestControllerAdvice +public class ExceptionHandler { + +} diff --git a/src/main/java/com/prgrms/catchtable/common/exception/custom/BadRequestCustomException.java b/src/main/java/com/prgrms/catchtable/common/exception/custom/BadRequestCustomException.java new file mode 100644 index 00000000..e173a35c --- /dev/null +++ b/src/main/java/com/prgrms/catchtable/common/exception/custom/BadRequestCustomException.java @@ -0,0 +1,11 @@ +package com.prgrms.catchtable.common.exception.custom; + +import com.prgrms.catchtable.common.exception.CommonException; +import com.prgrms.catchtable.common.exception.ErrorCode; + +public class BadRequestCustomException extends CommonException { + + public BadRequestCustomException(ErrorCode errorCode) { + super(errorCode); + } +} diff --git a/src/main/java/com/prgrms/catchtable/common/exception/custom/NotFoundCustomException.java b/src/main/java/com/prgrms/catchtable/common/exception/custom/NotFoundCustomException.java new file mode 100644 index 00000000..645f0d5e --- /dev/null +++ b/src/main/java/com/prgrms/catchtable/common/exception/custom/NotFoundCustomException.java @@ -0,0 +1,11 @@ +package com.prgrms.catchtable.common.exception.custom; + +import com.prgrms.catchtable.common.exception.CommonException; +import com.prgrms.catchtable.common.exception.ErrorCode; + +public class NotFoundCustomException extends CommonException { + + public NotFoundCustomException(ErrorCode errorCode) { + super(errorCode); + } +}