catch — wraps core command catch
script
? ?error_code_var_name
? ?options_var_name
?::rivet::catch wraps the core language's same command adding some extra error handling needed by mod_rivet design. The rationale for Rivet to have its own ::rivet::catch reads as follows: within mod_rivet a script execution can be interrupted by either calling ::rivet::exit(deprecated) or ::rivet::abort_page. These commands implement a simple internal exception mechanism by returning a special error code so that execution is in turn handed down to the AbortScript and eventually to AfterEveryScript (if any of them is defined). Any code calling one of these commands which runs under control of the ::catch command would need to do this chore itself, checking the error info and in case throw the error again if it had been originated by one of mod_rivet's exceptions calls. This is what ::rivet::catch does hiding the implementation details provide a better and more compatibile way to handle this condition.
Note | |
---|---|
This command is not meant to replace the core command, thus it's not exported from the ::rivet namespace and therefore has to be fully qualified. |