Name
RaiseOnError -- install a custom error handler (V5.2)
Synopsis
RaiseOnError(f)
Function
This function can be used to install a custom error handling function. Whenever an error occurs, this function will be called with the following four arguments: An error code, a string describing the error, the name of the last command, and the current line number.

This is useful if you do not want to use Hollywood's inbuilt automatic error handler. Please note that in certain situations the name of the last command and the current line number can be wrong.

Also note that if an error occurs in your custom error handling function, Hollywood will exit with a fatal error. Thus, you should keep the custom error handler as brief and straight-forward as possible.

To uninstall your custom error handler, simply pass Nil in the f argument.

See Error codes for a list of all error codes defined by Hollywood.

Inputs
f
function that shall be called whenever an error occurs
Example
Function p_ErrorFunc(code, msg$, cmd$, line)
   DebugPrint(code, msg$, cmd$, line)
EndFunction

RaiseOnError(p_ErrorFunc)

LoadBrush(1, "non_existing_brush.png")
The code above installs a custom error function and then tries to load a non-existing brush. This leads to the error function being called and further information will be printed to the debug device.

Show TOC