Hello.
Is there error handling of any sort in SmileBASIC?
I didn't think there was ON ERR GOTO at all.
I suppose you can handle most things by checking for files before loading, checking boundaries before calling the functions, and such.
Sort of wondering if there was error handling but I missed it.
Error Handling
Root / Programming Questions / [.]
HitomiHoshinoCreated:
Hello. Is there error handling of any sort in SmileBASIC? I didn't think there was ON ERR GOTO at all. I suppose you can handle most things by checking for files before loading, checking boundaries before calling the functions, and such. Sort of wondering if there was error handling but I missed it.It's not possible, because SB immediately throws and terminates your program when the error is encountered.
That's what I thought, other basics you can set up a label or line number for programs to transfer to when there is an error.
When the program is run from the browser, there is simply nothing you can do, except make every possible check you can before doing something, that that something won't cause an error. Not all things can be checked, that's just a fact of SmileBasic.
When the program is run from Direct mode, you have more options. Unavoidably, the user will be presented with Direct mode. What you can do is make it as easy as possible for the user to help handle the error. About the easiest thing you can ask the user to do that could be helpful is to press "F5" - the button at the very top-right of the touchscreen.
At the beginning of the program,
DIM KEY5$[0] PUSH KEY5$,KEY(5) KEY 5,"GOTO @ERROR_HANDLER"+CHR$(13)Just before the program ends,
KEY 5,POP(KEY5$)You can add more 'levels' of error handlers by PUSHing and POPing.