mirror of https://gitee.com/stylefeng/roses
【7.1.6】更新serviceException,异常可携带返回值
parent
c88c32f7e9
commit
1ad0efe435
|
@ -65,6 +65,11 @@ public class ServiceException extends RuntimeException {
|
|||
*/
|
||||
private String moduleName;
|
||||
|
||||
/**
|
||||
* 异常的具体携带数据
|
||||
*/
|
||||
private Object data;
|
||||
|
||||
/**
|
||||
* 根据模块名,错误码,用户提示直接抛出异常
|
||||
*/
|
||||
|
@ -97,4 +102,15 @@ public class ServiceException extends RuntimeException {
|
|||
this.userTip = exception.getUserTip();
|
||||
}
|
||||
|
||||
/**
|
||||
* 携带数据的异常构造函数
|
||||
*/
|
||||
public ServiceException(String moduleName, String errorCode, String userTip, Object data) {
|
||||
super(userTip);
|
||||
this.errorCode = errorCode;
|
||||
this.moduleName = moduleName;
|
||||
this.userTip = userTip;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue