Name

RaiseList Function

Syntax

function RaiseList: Pointer;

Description

The RaiseList function returns a pointer to the current exception frame, which might be the first node in a list of exceptions. The System unit does not declare the type of the exception frame; the record is shown in the example.

The first frame in the list is the current exception. If an exception handler raises an exception, you can have multiple frames in the exception list.

RaiseList is a real function.

Tips and Tricks

  • Usually, the try-except statement provides the necessary functionality for handling exceptions. You shouldn’t need to call RaiseList unless you are trying to handle exceptions in a non-standard way.

  • Each thread has its own separate exception list.

Example

type
  PRaiseFrame = ^TRaiseFrame;
  TRaiseFrame = packed record
    NextRaise: PRaiseFrame;
    ExceptAddr: Pointer;
    ExceptObject: TObject;
    ExceptionRecord: PExceptionRecord; // Type defined in Windows unit.
  end;
...
try
  ...
except
  Code := PRaiseFrame(RaiseList).ExceptionRecord.ExceptionCode;
  if Code = Exception_BreakPoint then
    ...
end;

See Also

ErrorProc Variable, Except Keyword, ExceptProc Variable, Raise Keyword, SetRaiseList Procedure, Try Keyword

Get Delphi in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.