It is still advisable that you catch all exceptions and handle them appropriately, as shown in the following code.
如下面的代码所示,发现所有的异常并正确的处理他们仍是明智之举。
As an alternative, you can catch this exception directly in your code and handle it some other way (perhaps printing out the actual error message along with usage information, for instance).
一个替代的方法是,您也可以在代码中直接捕捉这个异常,并且用其他方式处理异常(例如,可能会与使用信息一起输出真正的错误消息)。
You still need to handle this exception of course, but writing a catch block to handle a detected error is much simpler than writing code to detect all possible errors.
当然还需要处理这个异常,但编写一个catch块来处理检测到的错误比起编写代码来检测所有可能的错误来说要简单得多。
Submitted by Neal Gafter, this proposal includes catch blocks which handle multiple exception types and improved checking of re-thrown exceptions.
由NealGafter提交,这个提议包括处理多种异常的catch语句块和改进重新抛出的异常的检查。
Also note that the invoke method declares that it throws Throwable, so you either must catch it or let your testing framework handle it, as I've done.
还请注意invoke方法声明它要throws Throwable,必须捕获异常或者让测试框架处理它,就像我做的那样。
So we went to bed, and this morning we got away before she could catch us. and left Boyd to handle her.
今天一早,趁她还来不及抓住我们,我们便溜了出来,只留下博伊德一个人去对付她。
Web developers can use progressive enhancement to handle the fragmentation, while waiting for browser vendors to catch-up to the spec.
网页开发人员可以利用渐进式增强来应付浏览器能力的差异,并等待浏览器厂商逐渐达到规范。
While on the subject, it's worth noting that although the examples in this series use try-catch() blocks to trap and handle exceptions, this isn't strictly necessary.
关于这个问题,有一点值得注意:尽管本系列中的示例使用 try-catch() 代码块来捕捉和处理异常,但这并不是必须的。
When an exception is thrown, the runtime will begin to look for the nearest catch clause whose filters specify that it can handle the exception.
在引发异常时,运行库将开始查找其筛选器指定它可以处理该异常的最近的 catch 子句。
An exception specifier can omit the parameter name when a catch needs to know only the type of the exception in order to handle it.
说明符的类型决定了处理代码能够捕获的异常种类。
Catch and handle the exceptions that result from changes made by other threads.
拦截及处理由于其他执行绪所做变更而产生的例外状况。
Do not catch an exception unless you know how to handle it so that you do not corrupt the state of your program.
如果您不知道如何处理例外状况,请勿加以拦截,以免破坏程序的状态。
Then he turned the handle and let the hook go down into the well. He wanted the hook to catch the moon and pull it up!
然后转动把手,将钩子放到井中,他要让钩子钩住月亮把它拽上来。
The catch clause can handle exceptions thrown either from within the member initialization list or from within the constructor body.
catch子句既可以处理从成员初始化列表中抛出的异常,也可以处理从构造函数函数体中抛出的异常。
For Application Domain a to properly catch and handle the exception, it must be able to find the assembly containing the exception thrown by Application Domain b.
应用程序域a若想正确捕获和处理异常,它必须能够找到包含应用程序域b所引发的异常的程序集。
I've got my own handy little tricks to shut off my racing brain and catch a few more precious z's, and I picked up a bunch more when I asked my friends how they handle insomnia.
我找到一些方法来使自己的思绪截断,换回一点珍贵的呼噜声。当我问起我朋友如何解决失眠困扰时,也顺带学到了一堆的方法。
I've got my own handy little tricks to shut off my racing brain and catch a few more precious z's, and I picked up a bunch more when I asked my friends how they handle insomnia.
我找到一些方法来使自己的思绪截断,换回一点珍贵的呼噜声。当我问起我朋友如何解决失眠困扰时,也顺带学到了一堆的方法。
应用推荐