Originale-mail to me for new edition

 

Exceptions

 

An exception is raised when an error or other event interrupts normal execution of a program. The exception transfers control to an exception handler, which allows you to separate normal program logic from error-handling. Because exceptions are objects, they can be grouped into hierarchies using inheritance, and new exceptions can be introduced without affecting existing code. An exception can carry information, such as an error message, from the point where it is raised to the point where it is handled.

When an application uses the SysUtils unit, all runtime errors are automatically converted into exceptions. Errors that would otherwise terminate an application such as insufficient memory, division by zero, and general protection faults can be caught and handled.

When to use exceptions

Declaring exception types

Raising and handling exceptions

Standard exception classes and routines

 

Topic groups

 

See also

Classes and objects: Overview

 

 

译文

 

异常

 

当错误或者其他事件中断程序的正常执行时,异常(exception)被引发。异常把程序控制传递给异常处理程序(exception handler),这就允许开发者能将正常的程序逻辑与错误处理分开。因为异常是对象,所以可以通过继承将它们分组到多个层次,并且可以引入新的异常而不一向既有代码。异常可以携带信息,如错误消息,携带的信息在异常引发的点到其被处理的点之间一直有效。

应用程序使用了SysUtils单元时,所有的运行时错误都会自动地转换成为异常。其他终止应用程序的错误,如内存不足、零除、一般的保护错误等,都可以被截获和处理。

何时使用异常

声明异常类型

引发和处理异常

标准异常类和例程

 

主题组

 

相关主题

类和对象:概述