QB64.com

QB64 is a modern extended BASIC programming language that retains QBasic/QuickBASIC 4.5 compatibility and compiles native binaries for Windows, Linux, and macOS.

The _ERRORMESSAGE$ function returns a human-readable description of the most recent runtime error, or the description of an arbitrary error code passed to it.

Syntax

e$ = _ERRORMESSAGE$

e$ = _ERRORMESSAGE$(errorCode%)

Description

Example(s)

Using an error handler that ignores any error.


 ON ERROR GOTO Errhandler
   ' Main module program error simulation code
 ERROR 7           ' simulate an Out of Memory Error
 PRINT "Error handled...ending program"
 SLEEP 4
 SYSTEM            ' end of program code

 Errhandler:              'error handler sub program line label
  PRINT "Error"; ERR; "on program file line"; _ERRORLINE
  PRINT "Description: "; _ERRORMESSAGE$; "."
  BEEP             ' warning beep
 RESUME NEXT       ' moves program to code following the error. 

See Also