Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
RunError Procedure
◄Summary► ◄Details► ◄Example► ◄Back►
Argument
code Optional; integer expression representing a run-time error
number to pass to the calling program or operating system
(default is 0)
Description
The RunError procedure ends execution of the program and returns
control to the calling environment. RunError generates and displays
a specified run-time error.
The code argument passes a specified run-time error number from the
terminated program to the program executing it or to the DOS
environment. RunError passes 0 if the code argument is omitted. By
convention, 0 means no error. However, it is up to the terminating
program to establish a meaning for each error value.
Use either the DosExitCode function or the ERRORLEVEL option for
the IF batch command in DOS to examine the returned code.
To run a custom exit procedure as part of the exit sequence,
install the address of the procedure in ExitProc, a pointer defined
in the System unit. Use a custom exit procedure to restore vectors,
clean up open files, or trap run-time errors.