Commit dc3469fc authored by 唐峰's avatar 唐峰

自定义异常继承supper msg

parent 87428335
......@@ -207,7 +207,7 @@ public class ExceptionHandlingController implements IBaseController {
return JsonResult.buildErrorResultWhithCode(e.getMsg(),e.getBusinessCode());
}
@ExceptionHandler(SilentBizException.class)
public JsonResult<?> handleSilentBizException(BizException e) {
public JsonResult<?> handleSilentBizException(SilentBizException e) {
return JsonResult.buildErrorResultWhithCode(e.getMsg(),e.getBusinessCode());
}
}
......@@ -13,11 +13,13 @@ public class BizException extends RuntimeException {
public BizException(BizExceptionEnum bizExceptionEnum) {
super(bizExceptionEnum.getMsg());
this.msg = bizExceptionEnum.getMsg();
this.businessCode = bizExceptionEnum.getBusinessCode();
}
public BizException(BizExceptionEnum bizExceptionEnum,String attach) {
super(bizExceptionEnum.getMsg()+attach);
this.msg = bizExceptionEnum.getMsg()+attach;
this.businessCode = bizExceptionEnum.getBusinessCode();
}
......
......@@ -13,11 +13,13 @@ public class SilentBizException extends RuntimeException {
public SilentBizException(BizExceptionEnum bizExceptionEnum) {
super(bizExceptionEnum.getMsg());
this.msg = bizExceptionEnum.getMsg();
this.businessCode = bizExceptionEnum.getBusinessCode();
}
public SilentBizException(BizExceptionEnum bizExceptionEnum, String attach) {
super(bizExceptionEnum.getMsg());
this.msg = bizExceptionEnum.getMsg()+attach;
this.businessCode = bizExceptionEnum.getBusinessCode();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment