This was originally planned to be part of our soon to be released DBpro plugin named
STYX.
However, as this is kind of a hack, I decided to take it out of the plugin and release it separately for free.
What does it do?
It catches most (not all!!!) of the runtime errors that can occur in DarkBasic Pro applications.
How to use it?
Simply enclose an error prone block of code with CATCH and ENDCATCH. To find out if an error occured call GET ERROR() (see the docs).
Code example:
CATCH
Load Image "WrongMedia.txt", 1
ENDCATCH
If GET ERROR() = 0
Paste Image 1, 10, 10
Else
Print "Could not load image"
EndIf
When to use it?
Use it
very, very carefully. I recommend to use it before loading media or any other actions when the results are not predictable. If an error occured, save all necessary data, display a sensible error message and quit the app. You may skip the last steps at your own risk.
What about runtime errors in TPCs?
Currently only it only handles the commands that come with DBPro and (of course) the ones that will come with the STYX-Plugin. In the help folder there's a file for TPC developers that describes how to make CATCH/ENDCATCH work with their own plugins.
Unzip it into your DarkBasic Pro folder.
Have fun!
Edit: Tested with DBPro v.1.059 and up.