Skip to content

Commit ec1a1cd

Browse files
committed
feat: 모든 도메인에서 사용할 공통 예외 인터페이스 및 ServiceException 구현
1 parent 6e80989 commit ec1a1cd

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.example.log4u.common.exception.base;
2+
3+
import org.springframework.http.HttpStatus;
4+
5+
public interface ErrorCode {
6+
String name();
7+
HttpStatus getHttpStatus();
8+
String getErrorMessage();
9+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.example.log4u.common.exception.base;
2+
3+
4+
import lombok.Getter;
5+
6+
@Getter
7+
public class ServiceException extends RuntimeException {
8+
9+
private final ErrorCode errorCode;
10+
11+
public ServiceException(ErrorCode errorCode) {
12+
super(errorCode.getErrorMessage());
13+
this.errorCode = errorCode;
14+
}
15+
}

0 commit comments

Comments
 (0)