Definition: | crash_routine(integer rid) |
Description: |
Specify a function to be called when an error takes place at run time.
rid: the routine_id of the function to invoke. |
Comments: |
The supplied function should accept a single parameter, which is currently always 0.
Invoking crash_routine() adds a new function to a list of routines to execute upon a crash. The routines defined first are executed last. If a crash routine returns anything other than 0, the remaining routines in the chain are skipped. Note that, unlike OpenEuphoria, passing a rid of -1 clears the list. Be aware that crash_routine(routine_id("mis_spelt_name")) has the same effect. crash routines are not full fledged exception handlers (unlike try/catch), and they cannot resume execution. However, they can read the generated crash file, and might perform any action, including restarting the program. |
Example: |
function report_error(integer /*dummy*/) mylib:email("maintainer@remote_site.org", "ex.err") return 0 end function crash_routine(routine_id("report_error")) |
See Also: | try/catch, abort, crash_file, debugging and profiling |