mirror of
https://github.com/QB64-Phoenix-Edition/QB64pe.git
synced 2024-09-19 01:34:58 +00:00
aeb9c0668b
Note: Many files were removed (not yet existing/empty pages). The parser will try to download them on demand and will auto-generate text for missing pages (eg. most _gl pages).
44 lines
1.2 KiB
Text
44 lines
1.2 KiB
Text
{{QBDLDATE:05-20-2022}}
|
|
{{QBDLTIME:23:13:14}}
|
|
The [[ERROR]] statement is used to simulate a program error or to troubleshoot error handling procedures.
|
|
|
|
|
|
{{PageSyntax}}
|
|
: [[ERROR]] {{Parameter|codeNumber%}}
|
|
|
|
|
|
{{PageDescription}}
|
|
* Can be used to test an error handling routine by simulating an error.
|
|
* Error code 97 can be used to invoke the error handler for your own use, no real error in the program will trigger error 97.
|
|
* Use error codes between 100 and 200 for custom program errors that will not be responded to by QB64.
|
|
|
|
|
|
{{PageExamples}}
|
|
''Example:'' Creating custom error codes for a program that can be handled by an [[ON ERROR]] handling routine.
|
|
{{CodeStart}}
|
|
{{Cl|ON ERROR}} {{Cl|GOTO}} handler
|
|
|
|
{{Cl|IF...THEN|IF}} x = 0 {{Cl|THEN}} {{Cl|ERROR}} 123
|
|
x = x + 1
|
|
{{Cl|IF...THEN|IF}} x {{Cl|THEN}} {{Cl|ERROR}} 111
|
|
|
|
{{Cl|END}}
|
|
|
|
|
|
handler:
|
|
{{Cl|PRINT}} {{Cl|ERR}}, {{Cl|_ERRORLINE}}
|
|
{{Cl|BEEP}}
|
|
{{Cl|RESUME}} {{Cl|NEXT}}
|
|
{{CodeEnd}}
|
|
: '''Note: Don't use error codes under 97 or over 200 as QB64 may respond to those errors and interrupt the program.'''
|
|
|
|
|
|
{{PageSeeAlso}}
|
|
*[[ON ERROR]]
|
|
*[[ERR]], [[ERL]]
|
|
*[[_ERRORLINE]]
|
|
*[[ERROR Codes]] (list)
|
|
|
|
|
|
{{PageNavigation}}
|
|
|