Propagation should take compromise, the body has not been long but muscular, allowing exceptions;
基于1个网页-相关网页
We've avoided this extra level of complexity and kept our code much cleaner by simply allowing exceptions to be thrown.
通过允许抛出异常,我们已避免了这种杂乱所产生的额外复杂性,并使代码保持更“整洁”。
The handler is not required to perform any action, and your code should avoid generating exceptions or allowing exceptions to propagate to the calling method.
处理程序不需要执行任何操作,您的代码应避免产生异常或允许异常传播到调用方法。
Thankfully, Scala treats exception handling as just another pattern match, allowing us to make smart choices when presented with a multiplicity of potential exceptions. Let's see this in action.
感谢scala实际上把异常处理作为了另外一种模式匹配,允许我们在遇到多样化的异常时能做出更聪明的决定。
应用推荐