Name
AssertErrorProc Variable
Syntax
var AssertErrorProc: Pointer; procedureErrorProc(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
AssertErrorProcprocedure can return, in which case the program continues with the statement following theAssertprocedure call.If
AssertErrorProcisnil, Delphi raises runtime error 21 (EAssertError).The
SysUtilsunit sets this variable to a procedure that raises anEAssertErrorexception.
See Also
| AbstractErrorProc Variable, Assert Procedure, ErrorProc Variable, ExceptProc Variable |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access