package foundation.exception;
|
|
public class BusinessException extends RuntimeException{
|
|
private int code;
|
|
public BusinessException(int code, String message) {
|
super(message);
|
this.code = code;
|
}
|
|
public BusinessException(ExceptionEnum exceptionEnum) {
|
super(exceptionEnum.getMessage());
|
this.code = exceptionEnum.getCode();
|
}
|
|
public int getCode() {
|
return code;
|
}
|
|
@Override
|
public String toString() {
|
return "BusinessException{" +
|
"message=" + this.getMessage() +
|
", code=" + code +
|
'}';
|
}
|
}
|