Often you would create a debugger internally which would catch the errors and output a relavent error log, alternatively, you could use an event log file and attempt to figure out where it went wrong from that...
I would say have a look at
STYX for its error trapping,
Matrix1utils may feature a similar function.
Quote from STYX:
Quote: "
Runtime Error Handling and Anti-Aliasing
Handle a wide range of runtime errors in your DarkBASIC Professional application. So you can prevent the program from terminating if you load corrupted media files for example. The latest version of STYX allows you to control the anti-alias settings of your 3D scenes, too.
"
Quote from Matrix1Utils:
Quote: "
06 - Error message control - Take a little control over DBPro error messages, or even trigger your own (with a line number!)
"
Hope that helps...
EDIT
OH AND WELCOME to the Forums mike01082