Skip to content

Commit 8cbd31b

Browse files
committed
Feat : 에러메시지와 , 개시글이 존재하지 않는 예외처리
1 parent 99ff8b3 commit 8cbd31b

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
11
package com.leets.X.domain.post.exception;
22

3+
import lombok.AllArgsConstructor;
4+
import lombok.Getter;
5+
6+
@Getter
7+
@AllArgsConstructor
38
public enum ErrorMessage {
9+
10+
POST_NOT_FOUND(404,"존재하지 않는 게시글입니다.");
11+
12+
private final int code;
13+
private final String message;
14+
415
}
Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
package com.leets.X.domain.post.exception;
22

3-
public class PostNotFoundExceptiom {
4-
public class PostNotFoundException extends RuntimeException {
5-
public PostNotFoundException(String message) {
6-
super(message);
7-
}
3+
public class PostNotFoundException extends RuntimeException {
4+
5+
public PostNotFoundException() {
6+
super("해당 게시글을 찾을 수 없습니다.");
7+
}
8+
9+
// 사용자 정의 메시지를 받을 수 있는 생성자
10+
public PostNotFoundException(String message) {
11+
super(message);
812
}
13+
914
}

0 commit comments

Comments
 (0)