RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
System.RunError Function

Stops execution and generates a runtime error.

Pascal
procedure RunError; overload;
procedure RunError(Errorcode: Byte); overload;
C++
RunError();
RunError(Byte Errorcode);

In Delphi, the RunError procedure stops program execution by generating a runtime error with the given number at the current statement. Errorcode is the runtime error number (0 if omitted).  

Delphi Examples: 

 

{
This example demonstrates how to set a run error, the behavior of
execution and the message that follows.
}
var P: Pointer;

procedure TForm1.Button1Click(Sender: TObject);
begin
{$IFDEF Debug}
  if P = nil then
    RunError(204);
{$ENDIF}
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  P:= nil;
end;

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!