[Coco] BASIC09 error handling schema?

Wayne Campbell asa.rand at gmail.com
Sun Jun 3 14:55:46 EDT 2018


This is from memory, which may be unclear. Basic09 has no internal error
handling. The ON ERROR GOTO statement allows the programmer to trap for
most errors and handle them within the procedure. There are a few
untrappable errors, though I can't name them off the top of my head.

ON ERROR will turn off error checking. ERROR <num> will generate an error
of the specified error code number so you can test your error trap.

When an error occurs, execution is transferred to the line number specified
in the ON ERROR GOTO statement. You can have multiple ON ERROR GOTO
statements in a given procedure. An error generated will cause execution to
be transferred to the last defined error trap line number.

Hope this helps answer your question.

Wayne


On Sun, Jun 3, 2018, 10:16 AM James Jones <jejones3141 at gmail.com> wrote:

> BASIC09 still has some unfortunate characteristics for backwards
> compatibility with less-structured BASICs, and one of them is ON ERROR
> GOTO.
>
> Is this a reasonable schema to give error handling some kind of structure?
> (I don't know how BASIC09/RunB handle errors--I'd like to think that it
> sets up an error handler once and for all at the top and just remembers
> where it's been told to go on error (or that it hasn't been told, so it
> does its default action.)
>
>             ON ERROR GOTO <line #>
>            <statement which may cause error>
>             IF FALSE THEN
> <line #>    <code to handle error>
>             ENDIF
>             ON ERROR
>
> --
> Coco mailing list
> Coco at maltedmedia.com
> https://pairlist5.pair.net/mailman/listinfo/coco
>


More information about the Coco mailing list