[Overview][Types][Classes][Variables][Index] | Reference for unit 'CustApp' (#fcl)

# TCustomApplication.HandleException

Handle an exception.

## Declaration

Source position: custapp.pp line 54

`public procedure TCustomApplication.HandleException(`
`Sender: TObject`
`); virtual;`

## Arguments

`Sender` |  | Sender class calling this routine

## Description

HandleException is called (or can be called) to handle the exception Sender. If the exception is not of class Exception then the default handling of exceptions in the SysUtils unit is called.

If the exception is of class Exception and the OnException handler is set, the handler is called with the exception object and Sender argument.

If the OnException handler is not set, then the exception is passed to the ShowException routine, which can be overridden by descendent application classes to show the exception in a way that is fit for the particular class of application. (a GUI application might show the exception in a message dialog.

When the exception is handled in the above manner, and the StopOnException property is set to True, the Terminated property is set to True, which will cause the Run loop to stop, and the application will exit.

## See also

ShowException |  | Show an exception to the user
StopOnException |  | Should the program loop stop on an exception
Terminated |  | Was Terminate called or not
Run |  | Runs the application.

Documentation generated on: Feb 26 2014