Next: 11. Using assembler
Up: 10. Exceptions
Previous: 10.4 Exception handling nesting
10.5 Exception classes
The sysutils unit contains a great deal of exception handling.
It defines the following exception types:
Exception = class(TObject)
private
fmessage : string;
fhelpcontext : longint;
public
constructor create(const msg : string);
constructor createres(indent : longint);
property helpcontext : longint read fhelpcontext write fhelpcontext;
property message : string read fmessage write fmessage;
end;
ExceptClass = Class of Exception;
{ mathematical exceptions }
EIntError = class(Exception);
EDivByZero = class(EIntError);
ERangeError = class(EIntError);
EIntOverflow = class(EIntError);
EMathError = class(Exception);
The sysutils unit also installs an exception handler. If an exception is
unhandled by any exception handling block, this handler is called by the
Run-Time library. Basically, it prints the exception address, and it prints
the message of the Exception object, and exits with a exit code of 217.
If the exception object is not a descendent object of the Exception
object, then the class name is printed instead of the exception message.
It is recommended to use the Exception object or a descendant class for
all raise statemnts, since then you can use the message field of the
exception object.
root
1999-06-10