- Exception 패키지 생성
->

package com.selfstudy.frame.exception;
import lombok.Getter;
@Getter
public enum ExceptionCode {
MEMBER_NOT_FOUND(404, "Member not found"),
MEMBER_EXISTS(409, "Member exists");
private final int status;
private final String message;
ExceptionCode(int statusCode, String message) {
this.status = statusCode;
this.message = message;
}
}
- class
BusinessLogicException
생성 (RuntimeException 상속)
package com.selfstudy.frame.exception;
import lombok.Getter;
@Getter
public class BusinessLogicException extends RuntimeException {
private final ExceptionCode exceptionCode;
public BusinessLogicException(ExceptionCode exceptionCode) {
super(exceptionCode.getMessage());
this.exceptionCode = exceptionCode;
}
}