[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'sysutils' (#rtl)

# Exception

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Base class of all exceptions.

## Declaration

Source position: sysutilh.inc line 66

`type Exception = class(TObject)`
`public`
`constructor Create();` |  | Constructs a new exception object with a given message.
`constructor CreateFmt();` |  | Constructs a new exception object and formats a new message.
`constructor CreateRes();` |  | Constructs a new exception object and gets the message from a resource.
`constructor CreateResFmt();` |  | Constructs a new exception object and formats the message from a reasource.
`constructor CreateHelp();` |  | Constructs a new exception object and sets the help context.
`constructor CreateFmtHelp();` |  | Constructs a new exception object and sets the help context and formats the message
`constructor CreateResHelp();` |  | Constructs a new exception object and sets the help context and gets the message from a resource
`constructor CreateResFmtHelp();` |  | Constructs a new exception object and sets the help context and formats the message from a resource
`property HelpContext: LongInt; [rw]` |  | Help context associated with the exception.
`property Message: String; [rw]` |  | Message associated with the exception.
`end;`

## Inheritance

`Exception` |  | Base class of all exceptions.
`TObject`

## Description

Exception is the base class for all exception handling routines in the RTL and FCL. While it is possible to raise an exception with any class descending from TObject, it is recommended to use Exception as the basis of exception class objects: the Exception class introduces properties to associate a message and a help context with the exception being raised. What is more, the SysUtils unit sets the necessary hooks to catch and display unhandled exceptions: in such cases, the message displayed to the end user, will be the message stored in the exception class.

## See also

ExceptObject |  | Current Exception object.
ExceptAddr |  | Current exception address.
ExceptionErrorMessage |  | Return a message describing the exception.
ShowException |  | Show the current exception to the user.
Abort |  | Abort program execution.

The latest version of this document can be found at lazarus-ccr.sourceforge.net.