Files
Hui-s-notebook/异常使用.md
2024-05-09 22:58:28 +08:00

428 B
Raw Permalink Blame History

不要通过一个空的 catch 块忽略异常 finally 不要使用 return、break、continue 非正常结束 不要直接抛出 Exception自己定义业务异常 入参 check使用异常而不是在 check 方法中返回 result finally 必须对资源对象,流进行关闭,有异常也要 try-catch 调用 RPC、二方包、或动态生成类的相关方法时捕获异常必须使用 Throwable 类进行拦截