引用参考:
--java中的最顶级的异常类Throwable
[url]https://blog.youkuaiyun.com/pangqiandou/article/details/53448977[/url]
--【系列】重新认识Java语言——异常(Exception)
[url]https://blog.youkuaiyun.com/xialei199023/article/details/63251277[/url]
--Java 异常Exception e中e的getMessage()和toString()方法的区别
[url]http://blog.youkuaiyun.com/qq_34629352/article/details/54018840[/url]
--printStackTrace()、toString()、getMessage()的区别
[url]http://blog.youkuaiyun.com/qq_34629352/article/details/54018840[/url]
[b]示例1:[/b]
[b]示例2:[/b]
[img]http://dl2.iteye.com/upload/attachment/0124/0717/cf32bb62-97f8-36cf-9c3d-2a92245b6b63.jpg[/img]
--java中的最顶级的异常类Throwable
[url]https://blog.youkuaiyun.com/pangqiandou/article/details/53448977[/url]
--【系列】重新认识Java语言——异常(Exception)
[url]https://blog.youkuaiyun.com/xialei199023/article/details/63251277[/url]
--Java 异常Exception e中e的getMessage()和toString()方法的区别
[url]http://blog.youkuaiyun.com/qq_34629352/article/details/54018840[/url]
--printStackTrace()、toString()、getMessage()的区别
[url]http://blog.youkuaiyun.com/qq_34629352/article/details/54018840[/url]
[b]示例1:[/b]
-->service:
public int doFun(Param p) throws BusinessException{
int rtnFlag=-1;
try {
......
}catch (BusinessException e) {
//业务异常处理
throw e;
}catch (Exception e){
//其它异常处理
logger.error("验证...异常", e);
throw new BusinessException("验证...异常", e);
}
return rtnFlag;
}
-->controller:
public InterfaceResponse doControllerFum(Map<String, Object> p){
try{
InterfaceResponseImpl response = new InterfaceResponseImpl();
...
return InterfaceResponse.success("...成功",response);
...
return InterfaceResponse.fail("...失败",null);
}catch(Exception e){
logger.error("...service异常:",e);
return InterfaceResponse.error("...service异常",null);
}
}
[b]示例2:[/b]
[img]http://dl2.iteye.com/upload/attachment/0124/0717/cf32bb62-97f8-36cf-9c3d-2a92245b6b63.jpg[/img]