TA 역할 Spring 경계 smoke #7
1 changed files with 34 additions and 0 deletions
|
|
@ -0,0 +1,34 @@
|
|||
package com.klaroworks.runtime.exception;
|
||||
|
||||
public abstract class BaseException extends RuntimeException {
|
||||
private final ErrorCode errorCode;
|
||||
|
||||
protected BaseException(ErrorCode errorCode) {
|
||||
super(errorCode.getMessage());
|
||||
this.errorCode = errorCode;
|
||||
}
|
||||
|
||||
protected BaseException(ErrorCode errorCode, String message) {
|
||||
super(message);
|
||||
this.errorCode = errorCode;
|
||||
}
|
||||
|
||||
public ErrorCode getErrorCode() { return errorCode; }
|
||||
}
|
||||
|
||||
class BusinessException extends BaseException {
|
||||
public BusinessException(ErrorCode errorCode) { super(errorCode); }
|
||||
public BusinessException(ErrorCode errorCode, String message) { super(errorCode, message); }
|
||||
}
|
||||
|
||||
class RoleNotFoundException extends BusinessException {
|
||||
public RoleNotFoundException(Long roleId) {
|
||||
super(ErrorCode.ROLE_NOT_FOUND, String.format("Role not found with id: %d", roleId));
|
||||
}
|
||||
}
|
||||
|
||||
class DuplicateResourceException extends BusinessException {
|
||||
public DuplicateResourceException(String resourceType, String identifier) {
|
||||
super(ErrorCode.DUPLICATE_ROLE_NAME, String.format("%s '%s' already exists", resourceType, identifier));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue