/**
* 业务系统 RuntimeException
* 业务异常, 需要对外抛错。
* 1. 接管异常信息
* 2. 单据信息与后台信息交互
* 3. 业务错误进行回滚
*
* @XXX
*
*/
public class BusinessException extends RuntimeException{
private static final long serialVersionUID = 1L;
private String msg;//错误消息
private boolean async; //是否异步
public BusinessException(){
super();
}
public BusinessException(String msg) {
super(msg);
this.async = false;
this.msg = msg;
}
public BusinessException(Exception e){
super(e.getMessage());
this.async = false;
if(e instanceof BusinessException){
BusinessExceptionself = (BusinessException) e;
this.msg = self.getMsg();
}else{
this.msg = e.getMessage();
}
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public boolean isAsync() {
return async;
}
public void setAsync(boolean async) {
this.async = async;
}
public static BusinessException BE(String msg){
return new BusinessException (msg);
}
}