-
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.
- Loading branch information
Showing
4 changed files
with
68 additions
and
0 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
37 changes: 37 additions & 0 deletions
37
backend/src/main/java/org/dgu/backend/exception/MarketErrorResult.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,37 @@ | ||
package org.dgu.backend.exception; | ||
|
||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
import org.dgu.backend.common.code.BaseErrorCode; | ||
import org.dgu.backend.common.dto.ErrorReasonDto; | ||
import org.springframework.http.HttpStatus; | ||
|
||
@Getter | ||
@RequiredArgsConstructor | ||
public enum MarketErrorResult implements BaseErrorCode { | ||
NOT_FOUND_MARKET(HttpStatus.NOT_FOUND, "404", "존재하지 않는 가상화폐입니다."), | ||
NOT_FOUND_MARKETS(HttpStatus.NOT_FOUND, "404", "가상화폐 목록이 존재하지 않습니다."); | ||
|
||
private final HttpStatus httpStatus; | ||
private final String code; | ||
private final String message; | ||
|
||
@Override | ||
public ErrorReasonDto getReason() { | ||
return ErrorReasonDto.builder() | ||
.isSuccess(false) | ||
.code(code) | ||
.message(message) | ||
.build(); | ||
} | ||
|
||
@Override | ||
public ErrorReasonDto getReasonHttpStatus() { | ||
return ErrorReasonDto.builder() | ||
.isSuccess(false) | ||
.httpStatus(httpStatus) | ||
.code(code) | ||
.message(message) | ||
.build(); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
backend/src/main/java/org/dgu/backend/exception/MarketException.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,15 @@ | ||
package org.dgu.backend.exception; | ||
|
||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@Getter | ||
@RequiredArgsConstructor | ||
public class MarketException extends RuntimeException { | ||
private final MarketErrorResult marketErrorResult; | ||
|
||
@Override | ||
public String getMessage() { | ||
return marketErrorResult.getMessage(); | ||
} | ||
} |
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