The compiler can optionally insert code to catch certain runtime errors and call a special Sub "error_trap". Upon entry of the "error_trap" sub, two variables will be set indicating what type of error occurred "error_code", and an index into the compiler generated lookup table showing where the error occurred in the source code "error_index".
When debug mode is enabled, two global variables will automatically be generated:
error_code The type of
error that occurred.
1 - Integer overflow
2 - Integer underflow
3 - Stack overflow
error_index Lookup the
contents of this variable in the debug table generated
by the compiler to location the line of code that
generated the error.
If the default error_trap routine is to be used the file libs\debug.bas must be included in the project, otherwise it is up to the user to create their own Sub error_trap