-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Stadium, Rgb) : custom exception 적용
- Loading branch information
Showing
8 changed files
with
99 additions
and
6 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
common/src/main/java/org/depromeet/spot/common/exception/stadium/StadiumErrorCode.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,27 @@ | ||
package org.depromeet.spot.common.exception.stadium; | ||
|
||
import org.depromeet.spot.common.exception.ErrorCode; | ||
import org.springframework.http.HttpStatus; | ||
|
||
import lombok.Getter; | ||
|
||
@Getter | ||
public enum StadiumErrorCode implements ErrorCode { | ||
STADIUM_NOT_FOUND(HttpStatus.NOT_FOUND, "ST001", "요청 경기장이 존재하지 않습니다."), | ||
; | ||
|
||
private final HttpStatus status; | ||
private final String code; | ||
private String message; | ||
|
||
StadiumErrorCode(HttpStatus status, String code, String message) { | ||
this.status = status; | ||
this.code = code; | ||
this.message = message; | ||
} | ||
|
||
public StadiumErrorCode appended(Object o) { | ||
message = message + " {" + o.toString() + "}"; | ||
return this; | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
common/src/main/java/org/depromeet/spot/common/exception/stadium/StadiumException.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,20 @@ | ||
package org.depromeet.spot.common.exception.stadium; | ||
|
||
import org.depromeet.spot.common.exception.BusinessException; | ||
|
||
public abstract class StadiumException extends BusinessException { | ||
|
||
protected StadiumException(StadiumErrorCode errorCode) { | ||
super(errorCode); | ||
} | ||
|
||
public static class StadiumNotFoundException extends StadiumException { | ||
public StadiumNotFoundException() { | ||
super(StadiumErrorCode.STADIUM_NOT_FOUND); | ||
} | ||
|
||
public StadiumNotFoundException(String str) { | ||
super(StadiumErrorCode.STADIUM_NOT_FOUND.appended(str)); | ||
} | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
common/src/main/java/org/depromeet/spot/common/exception/util/UtilErrorCode.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,27 @@ | ||
package org.depromeet.spot.common.exception.util; | ||
|
||
import org.depromeet.spot.common.exception.ErrorCode; | ||
import org.springframework.http.HttpStatus; | ||
|
||
import lombok.Getter; | ||
|
||
@Getter | ||
public enum UtilErrorCode implements ErrorCode { | ||
INVALID_RGB_CODE(HttpStatus.BAD_REQUEST, "UT001", "잘못된 RGB 코드 값 입니다."), | ||
; | ||
|
||
private final HttpStatus status; | ||
private final String code; | ||
private String message; | ||
|
||
UtilErrorCode(HttpStatus status, String code, String message) { | ||
this.status = status; | ||
this.code = code; | ||
this.message = message; | ||
} | ||
|
||
public UtilErrorCode appended(Object o) { | ||
message = message + " {" + o.toString() + "}"; | ||
return this; | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
common/src/main/java/org/depromeet/spot/common/exception/util/UtilException.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.depromeet.spot.common.exception.util; | ||
|
||
import org.depromeet.spot.common.exception.BusinessException; | ||
|
||
public abstract class UtilException extends BusinessException { | ||
protected UtilException(UtilErrorCode errorCode) { | ||
super(errorCode); | ||
} | ||
|
||
public static class InvalidRgbCodeException extends UtilException { | ||
public InvalidRgbCodeException() { | ||
super(UtilErrorCode.INVALID_RGB_CODE); | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
dependencies { | ||
implementation(project(":common")) | ||
} | ||
|
||
tasks.jar { enabled = true } | ||
|
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