Skip to content

Commit 77374de

Browse files
committed
FEAT : Program 도메인 Error / Success / Exception 클래스 구현
1 parent 41bffbd commit 77374de

File tree

4 files changed

+41
-6
lines changed

4 files changed

+41
-6
lines changed

src/main/java/org/sopt/sopkerton/common/exception/ProgramError.java

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package org.sopt.sopkerton.program.domain.exception;
2+
3+
import lombok.AllArgsConstructor;
4+
import org.sopt.sopkerton.common.exception.base.ErrorBase;
5+
import org.springframework.http.HttpStatus;
6+
7+
@AllArgsConstructor
8+
public enum ProgramError implements ErrorBase {
9+
PROGRAM_NOT_FOUND(HttpStatus.NOT_FOUND, "Can not found Program."),
10+
11+
;
12+
13+
private final HttpStatus status;
14+
private final String errorMessage;
15+
@Override
16+
public int getHttpStatusCode() {
17+
return this.status.value();
18+
}
19+
20+
@Override
21+
public HttpStatus getHttpStatus() {
22+
return this.status;
23+
}
24+
25+
@Override
26+
public String getErrorMessage() {
27+
return this.errorMessage;
28+
}
29+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package org.sopt.sopkerton.program.domain.exception;
2+
3+
import org.sopt.sopkerton.common.exception.base.ExceptionBase;
4+
5+
public class ProgramException extends ExceptionBase {
6+
public ProgramException(ProgramError errorBase) {
7+
super(errorBase);
8+
}
9+
}

src/main/java/org/sopt/sopkerton/common/exception/ProgramSuccess.java renamed to src/main/java/org/sopt/sopkerton/program/domain/exception/ProgramSuccess.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
package org.sopt.sopkerton.common.exception;
1+
package org.sopt.sopkerton.program.domain.exception;
22

33
import lombok.AllArgsConstructor;
44
import org.sopt.sopkerton.common.exception.base.SuccessBase;
55
import org.springframework.http.HttpStatus;
66

77
@AllArgsConstructor
88
public enum ProgramSuccess implements SuccessBase {
9-
PROGRAM_LIST_VIEW_SUCCESS(HttpStatus.OK, "Get Program List View Data Successful.")
9+
PROGRAM_LIST_VIEW_SUCCESS(HttpStatus.OK, "Get Program List View Data Successful."),
10+
PROGRAM_DETAIL_VIEW_SUCCESS(HttpStatus.OK, "Get Program Detail View Data Successful.")
1011
;
1112

1213
private final HttpStatus status;

0 commit comments

Comments
 (0)