单纯根据堆栈跟踪可能很难指出产生异常的原因,而且当您的代码是由应用程序服务器托管时情况会更加复杂。
Figuring out what caused an exception from stack traces alone can be difficult, and it's even more complicated when your code is hosted by an application server.
处理程序代码可以使用这些回调中传递的信息,但是不能影响解析过程(除了引发一个异常)。
Your handler code can make use of the information passed by the call-backs, but cannot affect the parsing (except by throwing an exception).
同时,应用程序代码可能需要访问这些异常中的信息,因此不能轻易地抛弃或忽略它们。
At the same time, your application code may need to access the information within these exceptions, so you can't simply throw out or ignore them.
在代码中处理SQL异常并运行应用程序,以此判断SQL是否有效。
Handle SQL exceptions in your code and run your applications to find out whether the SQL is valid or invalid.
您应该对成员函数向您掷出的所有异常编制文档,以便其它程序员知道他们的代码将需要捕捉什么。
You should document any and all exceptions that a member function throws at you so that other programmers know what their code will need to catch.
通过它们的充分介绍,大多数程序员都能阅读带有异常的代码并能解释其作用。
They teach enough that most programmers can read code that employs exceptions and explain its actions.
然而,它的确会告诉代码管理员,某个程序员的注释是极其简洁的、异常冗长的还是对非编程人员来说是很难理解的。
It does, however, tell the code manager if comments from a programmer are unusually terse, unusually verbose, or difficult for a nonprogrammer to understand.
由于此代码仅仅作为样例使用,我们没有执行任何实际的错误处理,但是我们实现了一个虚构的异常处理程序,从而完成代码的编译。
Because this code is only a sample we don't perform any real error processing, but we do implement a dummy exception handler to allow the code to compile.
通过打开异常跟踪,您将可以提供堆栈的多个快照作为从应用程序代码层冒出的异常。
By switching on exception tracing, you will be able to provide multiple snapshots of the stack as an exception bubbles up through layers of application code.
在生产代码内这个异常应被明确捕获以便应用程序在用户提供了不正确的代码时能够进行恰当的响应。
This exception will be caught specifically in your production code so that your application can respond graciously when a user supplies an incorrect password.
应用程序代码也往往捕获并转换异常,其间常常废弃许多详细信息。
Application code also tends to catch and translate exceptions, usually discarding many details in the process.
这样一来,测试数据修改后应用程序是否还能工作就显得异常简单,无须修改任何源代码。
That way, testing if an application still works if the data is modified is really simple and does not require any modification of the source code.
事务使我们能够将很多异常处理和恢复工作委托给TPM 和RM,从而简化了我们的代码,并使我们能够空出更多时间来考虑应用程序逻辑。
Transactions enable us to delegate many elements of exception handling and recovery to the TPM and the RMs, simplifying our code and freeing us to think about application logic instead.
像添加未捕获的异常处理程序这样的简单库更改,可以极大地增加原代码的可理解性。
Simple library changes like adding an uncaught exception handler greatly increase the comprehensibility of source code.
如果J2EE应用程序接收ResourceException,则它可以检测该异常是否表示CICS事务异常终止,甚至可以确定特定的CICS异常终止代码是什么。
If the J2EE application receives a ResourceException, it can detect if the exception represents a CICS transaction abend, and even what the particular CICS abend code was.
在程序运行时一旦检测到约束的冲突,代码模式能够抛出相应的异常。
The code patterns can throw corresponding exception when having detected constraint violated during program's runtime.
异常是程序的一个未曾预料到的环节,没有代码被明确地设计用来处理包含问题的代码片断。
An exception is a situation in which a program has an unexpected circumstance that the section of code containing the problem is not explicitly designed to handle.
在结构化异常处理中,代码块是封装的,每个块有一个或几个关联的处理程序。
In structured exception handling, blocks of code are encapsulated, with each block having one or more associated handlers.
如果遇到在引用其他程序集的代码中发生运行时异常或其他错误条件,并且找不出其他原因,则您可能正在使用过期的程序集。
If you encounter runtime exceptions or other error conditions that occur in code that references another assembly, and have no other identified cause, you may be dealing with an out of date assembly.
异常处理机制是一种运行时错误通知机制,将程序的正常控制代码和错误处理代码分离。
Exception handling is a runtime-error notifying mechanism. It separates the error handling code from normal code and makes software do its utmost to run on the normal state.
您可以让调试器在遇到任何未由用户代码(“我的代码”)中的处理程序处理的异常时中断执行。
You can tell the debugger to break on any exception that is not handled by a handler in user code (" My code ").
通过在应用程序中放置异常处理代码,可以处理用户可能遇到的大多数错误并使应用程序能够继续运行。
By placing exception handling code in your application, you can handle most of the errors users may encounter and enable the application to continue running.
例如,假设应用程序域a创建应用程序域b,后者执行引发异常代码。
For example, suppose Application Domain a creates Application Domain B, which executes code that throws an exception.
当托管代码抛出异常时发生,在运行时在调用堆栈中搜索应用程序域中的异常处理程序之前。
Occurs when an exception is thrown in managed code, before the runtime searches the call stack for an exception handler in the application domain.
正如上一节中描述的那样,语言特定处理程序作为异常处理程序搜索的一部分或展开代码的一部分进行调用。
As described in the previous section, the language specific handler is called as part of the search for an exception handler or as part of an unwind.
异常在出现问题时由代码引发,并在堆栈中向上传递,直到应用程序对其进行处理或者程序失败。
An exception is thrown by code when a problem occurs, and it is passed up the stack until the application handles it or the program fails.
可以轻松添加异常处理代码,以增加程序的可靠性。
Exception-handling code can be easily added to increase program reliability.
处理程序不需要执行任何操作,您的代码应避免产生异常或允许异常传播到调用方法。
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.
处理程序不需要执行任何操作,您的代码应避免产生异常或允许异常传播到调用方法。
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.
应用推荐