Name

AssertErrorProc Variable

Syntax

var AssertErrorProc: Pointer;

procedure ErrorProc(const Message, FileName: string;
    LineNumber: Integer; ErrorAddress: Pointer);
AssertErrorProc := @ErrorProc

Description

When an assertion fails, Delphi calls the procedure whose address is stored in the AssertErrorProc variable. The compiler passes the assertion message and the location of the Assert statement to the procedure.

Tips and Tricks

  • You can implement this procedure to take any action, such as logging the failure, sending email to your QA staff, etc. Unlike the other error-handling procedures, the AssertErrorProc procedure can return, in which case the program continues with the statement following the Assert procedure call.

  • If AssertErrorProc is nil, Delphi raises runtime error 21 (EAssertError).

  • The SysUtils unit sets this variable to a procedure that raises an EAssertError exception.

See Also

AbstractErrorProc Variable, Assert Procedure, ErrorProc Variable, ExceptProc Variable

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.