Exception

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

Base class of all exceptions.

Declaration

Source position: sysutilh.inc line 107

Type
  Exception = class (TObject)
  private
    fmessage : string;
    fhelpcontext : LongInt;
  public
    constructor Create(const msg: string);
    constructor CreateFmt(const msg: string; const args: Array of const);
    constructor CreateRes(ResString: PString);
    constructor CreateResFmt(ResString: PString; const Args: Array of const);
    constructor CreateHelp(const Msg: string; AHelpContext: LongInt);
    constructor CreateFmtHelp(const Msg: string; 
                             const Args: Array of const; 
                             AHelpContext: LongInt);
    constructor CreateResHelp(ResString: PString; AHelpContext: LongInt);
    constructor CreateResFmtHelp(ResString: PString; 
                                const Args: Array of const; 
                                AHelpContext: LongInt);
    function ToString : string;  Override;
    HelpContext : LongInt;
    Message : string;
  end
  ;

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.

Members

Member Type Visibility Description
Create Method public Constructs a new exception object with a given message.
CreateFmt Method public Constructs a new exception object and formats a new message.
CreateFmtHelp Method public Constructs a new exception object and sets the help context and formats the message
CreateHelp Method public Constructs a new exception object and sets the help context.
CreateRes Method public Constructs a new exception object and gets the message from a resource.
CreateResFmt Method public Constructs a new exception object and formats the message from a resource.
CreateResFmtHelp Method public Constructs a new exception object and sets the help context and formats the message from a resource
CreateResHelp Method public Constructs a new exception object and sets the help context and gets the message from a resource
fhelpcontext Field private
fmessage Field private
HelpContext Property public Help context associated with the exception.
Message Property public Message associated with the exception.
ToString Method public Nicely formatted version of the exception message

Inheritance

Class Description
Exception Base class of all exceptions.

See also

Name Description
Abort Abort program execution.
ExceptAddr Current exception address.
ExceptionErrorMessage Return a message describing the exception.
ExceptObject Current Exception object.
LongInt A signed 32-bits integer
LongInt A signed 32-bits integer
ShowException Show the current exception to the user.