-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor - #111 UserError, UserException, UserSuccess 분
- Loading branch information
Showing
8 changed files
with
92 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/main/java/sopt/org/hmh/domain/users/domain/exception/UserError.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package sopt.org.hmh.domain.users.domain.exception; | ||
|
||
import lombok.AllArgsConstructor; | ||
import org.springframework.http.HttpStatus; | ||
import sopt.org.hmh.global.common.exception.base.ErrorBase; | ||
|
||
@AllArgsConstructor | ||
public enum UserError implements ErrorBase { | ||
|
||
// 404 NOT FOUND | ||
NOT_FOUND_USER(HttpStatus.NOT_FOUND, "유저를 찾을 수 없습니다."), | ||
; | ||
|
||
private final HttpStatus status; | ||
private final String errorMessage; | ||
|
||
@Override | ||
public int getHttpStatusCode() { | ||
return this.status.value(); | ||
} | ||
|
||
@Override | ||
public HttpStatus getHttpStatus() { | ||
return this.status; | ||
} | ||
|
||
@Override | ||
public String getErrorMessage() { | ||
return this.errorMessage; | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/java/sopt/org/hmh/domain/users/domain/exception/UserException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package sopt.org.hmh.domain.users.domain.exception; | ||
|
||
import sopt.org.hmh.global.common.exception.base.ExceptionBase; | ||
|
||
public class UserException extends ExceptionBase { | ||
|
||
public UserException(UserError errorBase) { | ||
super(errorBase); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
src/main/java/sopt/org/hmh/domain/users/domain/exception/UserSuccess.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package sopt.org.hmh.domain.users.domain.exception; | ||
|
||
import lombok.AllArgsConstructor; | ||
import org.springframework.http.HttpStatus; | ||
import sopt.org.hmh.global.common.exception.base.SuccessBase; | ||
|
||
@AllArgsConstructor | ||
public enum UserSuccess implements SuccessBase { | ||
|
||
// 200 OK | ||
GET_USER_INFO_SUCCESS(HttpStatus.OK, "유저의 정보를 불러오는데에 성공했습니다."), | ||
GET_USER_POINT_SUCCESS(HttpStatus.OK, "유저의 포인트 정보를 불러오는데에 성공했습니다."), | ||
LOGOUT_SUCCESS(HttpStatus.OK, "로그아웃에 성공했습니다."), | ||
WITHDRAW_SUCCESS(HttpStatus.OK, "회원 탈퇴를 성공하였습니다."), | ||
; | ||
|
||
private final HttpStatus status; | ||
private final String successMessage; | ||
|
||
@Override | ||
public int getHttpStatusCode() { | ||
return this.status.value(); | ||
} | ||
|
||
@Override | ||
public HttpStatus getHttpStatus() { | ||
return this.status; | ||
} | ||
|
||
@Override | ||
public String getSuccessMessage() { | ||
return this.successMessage; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters