Exception Handling

The definition exception handling could be misleading. This is a mechanism based on the command abort_page, rather than a language specific exception handling as it's done in tcl8.6 or through the 'catch' core command.

abort_page terminates a script and returns control to the module core with a special return code. The module checks the error code and skips subsequent scripts (AfterScript) printing an error message and dropping already sent page contents from the output channel.

this is a proposal for a new handling of this mechanism that hopefully should preserve existing code maintaining full compatibility:

Any subsequent call to the command will return TCL_OK disabling its effects within ForceAfterScript (just making sure that it cannot be interrupted in this way).

Basically, the code in Rivet_ExecuteAndCheck where the abort condition is checked

if (strcmp (Tcl_GetString (errorCodeElementObj), "RIVET") == 0) {


should test the definition of a new conf variable rivet_abort_script and execute it if defined. The whole function has to also check for the new conf variable rivet_force_script and run it anyway before printing the headers and flushing the channel.

ExceptionHandling (last edited 2011-02-10 15:02:35 by MassimoManghi)