PureBasic - OnError
This library provides a way to track program errors (program crashes) similar to the PureBasic debugger but without the drawbacks of a bigger filesize and lower execution speed when using the debugger. This way the final version of a program which is shipped to the end user can still intercept program errors and provide some information about the error to the user so he can report it back to the developer.
The PureBasic debugger is still the better tool for finding bugs during the development phase, as it provides much more detailed information about the state of the program (like actual variable values) and also has a number of interactive features to quickly locate bugs.
Note: If both this library and the PureBasic debugger are used, not all errors will be caught by the OnError library as some checks are made and reported by the debugger even before the actual code with the error is executed.
This library can provide information about the source code file and line at which the error occurred through the ErrorFile() and ErrorLine() commands, but only if this feature is enabled when compiling the program (it causes a very small slowdown in execution speed to track the line numbers). To enable this feature, enable the "Enable OnError lines support" checkbox in the compiler options or specify the /LINENUMBERING (Windows) or --linenumbering (Linux, Mac OSX) command-line switch when compiling from the command-line.