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

# TApplication.HandleException

HandleException method for handling an exception; attempts to maintain program execution if possible, otherwise exits gracefully.

## Declaration

Source position: forms.pp line 1613

`public procedure TApplication.HandleException(`
`Sender: TObject`
`); override;`

## Arguments

`Sender` |  | Object instance (TApplication) for the exception.

## Description

Individual exception handler methods should be supplied by the application programmer to override place-holder entries declared in ancestor classes. This method checks whether the application is halted when an exception occurs, or invokes the appropriate handler. It also writes details about the exception to the appropriate place for debugging.

HandleException may signal the OnCircularException event handler (when assigned) if an exception is raised while the method is already active.

HandleException ensures that existing capture(s) are released, and that all forms with the stay on top attribute are removed so that the exception message can be shown.

The OnException event handler (and other handlers for the ahtException handler type) are signalled (when assigned). If OnException handlers are not used, the ShowException method is called.

Any forms with the stay on top attribute are restored prior to exiting the method.

## See also

TCustomApplication.HandleException