我们应该检查异常类型,但此处我们将假定它意味着没有找到相应结果。
We should check the exception type, but here we'll just assume it means that no results were found.
已检查异常继承自exception类并用于处理可恢复性出错诸如业务出错场景。
Checked exceptions inherit from exception class and are used to handle recoverable errors such as business error scenarios.
未检查异常作为运行时exception类是理想的异常侯选处理不可恢复性出错,如资源不可用或者空指针。
Unchecked exceptions which are descendents of RuntimeException class are the ideal candidate exceptions handle non-recoverable errors such as resource non-availability or some null Pointers.
应用推荐