mirror of
https://gitee.com/bookshelfplus/bookshelfplus
synced 2025-10-07 00:15:15 +08:00
38 lines
880 B
Java
38 lines
880 B
Java
package plus.bookshelf.Common.Error;
|
|
|
|
/**
|
|
* 包装器业务异常类实现
|
|
*/
|
|
public class BusinessException extends Exception implements CommonError {
|
|
|
|
private CommonError commonError;
|
|
|
|
public BusinessException(CommonError commonError) {
|
|
super();
|
|
this.commonError = commonError;
|
|
}
|
|
|
|
// 接收自定义errMsg的方式构造业务异常
|
|
public BusinessException(CommonError commonError, String errMsg) {
|
|
super();
|
|
this.commonError = commonError;
|
|
this.commonError.setErrMsg(errMsg);
|
|
}
|
|
|
|
@Override
|
|
public int getErrCode() {
|
|
return this.commonError.getErrCode();
|
|
}
|
|
|
|
@Override
|
|
public String getErrMsg() {
|
|
return this.commonError.getErrMsg();
|
|
}
|
|
|
|
@Override
|
|
public CommonError setErrMsg(String errMsg) {
|
|
this.commonError.setErrMsg(errMsg);
|
|
return this;
|
|
}
|
|
}
|