Would it be possible for GLB to support TRY ... CATCH blocks and THROW functionality for handling unexpected and expected errors?
This is not generally something you see in traditional BASIC's but you do get in most modern langauges (including VB) because it can help you to manage runtime errors quite easily.
Nice idea. Easy to implement, I think.
Cool, I was hoping it might be as there is a direct C++ equivalent.
oh yes, that would be great!
Exceptions are good. :)
Oooh yes please. Hadn't noticed this topic before now.
TRY
...
foo()
CATCH err$
...
ENDTRY
FUNCTION foo:
THROW "up"
ENDFUNCTION
Would that be OK?
Will this also catch divide by zero and other runtime errors?
No, it shouldn't - the throw would force the CATCH command to run, as per this C++ example :
try {
buf = new char[512];
if( buf == 0 )
throw "Memory allocation failure!";
}
catch( char * str ) {
cout << "Exception raised: " << str << '\n';
}