This program tests the error handling of ScriptBasic. It has to print An error has occured, but this is no problem.. In case you uncomment the ON ERROR GOTO statement inside the subroutine the subroutine has to handle the error.
Example onerror.bas :
print "No error has occured in the function"
goto FinishLabel
ErrorLabel:
print "An error has occured inside the sub"
print
FinishLabel:
end sub
on error goto ErrorLabel
ErrorSub
print "No error"
goto FinishLabel
ErrorLabel:
print " An error has occured, but this is no problem."
FinishLabel:
sub ErrorSub
'on error goto ErrorLabel
open "nofile" for input as 1
Result executing onerror.bas :
Possible error messages sent to stderr: