You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
913 B
41 lines
913 B
package exception;
|
|
|
|
import api.StatusCode;
|
|
|
|
public class BizException extends RuntimeException {
|
|
private static final long serialVersionUID = 2466145171145432619L;
|
|
private StatusCode codeEnum;
|
|
private Integer code = 500;
|
|
|
|
public BizException(String message) {
|
|
super(message);
|
|
}
|
|
|
|
public BizException(String message, Integer code) {
|
|
super(message);
|
|
this.code = code;
|
|
}
|
|
|
|
public StatusCode getCodeEnum() {
|
|
return codeEnum;
|
|
}
|
|
|
|
public Integer getCode() {
|
|
return this.code;
|
|
}
|
|
|
|
public BizException(StatusCode codeEnum) {
|
|
super(codeEnum.getMessage());
|
|
this.codeEnum = codeEnum;
|
|
this.code = codeEnum.getCode();
|
|
}
|
|
|
|
/**
|
|
* 重写fillInStackTrace 业务异常不需要堆栈信息,提高效率.
|
|
*/
|
|
@Override
|
|
public Throwable fillInStackTrace() {
|
|
return this;
|
|
}
|
|
}
|