Skip to content

Exception

Base class of all exceptions.

Declaration

Source position: sysutilh.inc line 107

type

  Exception = class(TObject)
  public
    constructor Create;
    constructor CreateFmt;
    constructor CreateRes;
    constructor CreateResFmt;
    constructor CreateHelp;
    constructor CreateFmtHelp;
    constructor CreateResHelp;
    constructor CreateResFmtHelp;
    destructor Destroy;
    function ToString : RTLString;
    function GetBaseException : Exception;
    class procedure RaiseOuterException;
    class procedure ThrowOuterException;
    property BaseException: Exception; {r}
    property HelpContext: LongInt; {rw}
    property InnerException: Exception; {r}
    property Message: string; {rw}
    property StackTrace: string; {r}
    property StackInfo: Pointer; {r}
  class var
    GetExceptionStackInfoProc:  = function(aInfo: PExceptObject) : Pointer;
    GetStackInfoStringProc:  = function(aStackInfo: Pointer) : string;
    CleanUpStackInfoProc:  = procedure(aStackInfo: Pointer);
  end;

Inheritance

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.

Properties

Member Visibility Description
BaseException read only public
HelpContext public Help context associated with the exception.
InnerException read only public
Message public Message associated with the exception.
StackInfo read only public
StackTrace read only public
See all Properties

Methods

Member Visibility Description
Create public Constructs a new exception object with a given message.
CreateFmt public Constructs a new exception object and formats a new message.
CreateFmtHelp public Constructs a new exception object and sets the help context and formats the message.
CreateHelp public Constructs a new exception object and sets the help context.
CreateRes public Constructs a new exception object and gets the message from a resource.
CreateResFmt public Constructs a new exception object and formats the message from a resource.
CreateResFmtHelp public Constructs a new exception object and sets the help context and formats the message from a resource.
CreateResHelp public Constructs a new exception object and sets the help context and gets the message from a resource.
Destroy public
GetBaseException public
RaiseOuterException public
ThrowOuterException public
ToString public Nicely formatted version of the exception message.
See all Methods

Fieldss

Member Visibility Description
CleanUpStackInfoProc public
GetExceptionStackInfoProc public
GetStackInfoStringProc public
See all Fieldss

See also

Name Description
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.