1
1
Fork 0
mirror of https://github.com/QB64Official/qb64.git synced 2024-07-03 07:41:21 +00:00
qb64/internal/help/ERROR.txt

43 lines
1.2 KiB
Plaintext
Raw Normal View History

2017-10-10 14:55:21 +00:00
The [[ERROR]] statement is used to simulate a program error or to troubleshoot error handling procedures.
{{PageSyntax}}
2017-10-10 14:55:21 +00:00
: [[ERROR]] {{Parameter|codeNumber%}}
2017-10-10 14:55:21 +00:00
{{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.
2017-10-10 14:55:21 +00:00
{{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}}
2017-10-10 14:55:21 +00:00
: '''Note: Don't use error codes under 97 or over 200 as QB64 may respond to those errors and interrupt the program.'''
2017-10-10 14:55:21 +00:00
{{PageSeeAlso}}
*[[ON ERROR]]
*[[ERR]], [[ERL]]
2021-01-24 03:36:34 +00:00
*[[_ERRORLINE]], [[_ERRORMESSAGE$]]
*[[_INCLERRORLINE]], [[_INCLERRORFILE$]]
*[[ERROR Codes]] (list)
2019-04-15 01:15:33 +00:00
{{PageNavigation}}