RAD Studio |  |

VCL Exception Classes
See Also
Collapse All

VCL includes a large set of built-in exception classes for automatically handling divide-by-zero errors, file I/O errors, invalid typecasts, and many other exception conditions. All VCL exception classes descend from one root object called Exception. Exception provides a consistent interface for applications to handle exceptions. It provides the string for the message that VCL exceptions display by default.

The following table lists a selection of the exception classes defined in VCL:

Selected exception classes

Exception class | Description
EAbort | Stops a sequence of events without displaying an error message dialog box.
EAccessViolation | Checks for invalid memory access errors.
EBitsError | Prevents invalid attempts to access a Boolean array.
EComponentError | Signals an invalid attempt to register or rename a component.
EConvertError | Indicates string or object conversion errors.
EDatabaseError | Specifies a database access error.
EDBEditError | Catches data incompatible with a specified mask.
EDivByZero | Catches integer divide-by-zero errors.
EExternalException | Signifies an unrecognized exception code.
EInOutError | Represents a file I/O error.
EIntOverflow | Specifies integer calculations whose results are too large for the allocated register.
EInvalidCast | Checks for illegal typecasting.
EInvalidGraphic | Indicates an attempt to work with an unrecognized graphic file format.
EInvalidOperation | Occurs when invalid operations are attempted on a component.
EInvalidPointer | Results from invalid pointer operations.
EMenuError | Involves a problem with menu item.
EOleCtrlError | Detects problems with linking to ActiveX controls.
EOleError | Specifies OLE automation errors.
EPrinterError | Signals a printing error.
EPropertyError | Occurs on unsuccessful attempts to set the value of a property.
ERangeError | Indicates an integer value that is too large for the declared type to which it is assigned.
ERegistryException | Specifies registry errors.
EZeroDivide | Catches floating-point divide-by-zero errors.

There are other times when you will need to create your own exception classes to handle unique situations. You can declare a new exception class by making it a descendant of type Exception and creating as many constructors as you need (or copy the constructors from an existing class in the SysUtils unit).

See Also

Default Exception Handling in VCL

Silent Exceptions

Defining Your Own VCL Exceptions

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!