- Publicity: Public Only All
exception-procs.tcl
- Location:
- packages/acs-tcl/tcl/exception-procs.tcl
- Created:
- 2000-09-09
- Author:
- rhs@mit.edu
- CVS Identification:
$Id: exception-procs.tcl,v 1.13 2024/09/11 06:15:48 gustafn Exp $
Procedures in this file
- ad_exception (public)
- ad_raise (public)
- ad_try (public)
- ad_unless_script_abort (public)
Detailed information
ad_exception (public)
ad_exception errorCode
- Parameters:
- errorCode (required)
- Returns:
- ad_exception value or empty, in case the exception had other causes
- Author:
- gustaf.neumann@wu-wien.ac.at
- Created:
- 2015-12-31 Check if the exception was caused by ad_raise (i.e. was an OpenACS exception)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- ad_raise_exception
ad_raise (public)
ad_raise exception [ value ]
Raise an exception. If you use this I will kill you. Note: despite the warning, this proc has been used in acs-authentication.
- Parameters:
- exception (required)
- value (optional)
- Author:
- rhs@mit.edu
- Created:
- 2000-09-09
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- ad_raise_exception
ad_try (public)
ad_try [ -auto_abort ] body [ args... ]
Generic code for OpenACS to handle exceptions and traps based on Tcl's primitives. This implementation is a slight generalization of the Tcl 8.6 built-in ::try, which handles ad_script_aborts automatically. The command "ad_try" should replace the various exception handling constructs such as "catch", which tend to swallow often error conditions, making debugging unnecessarily hard. It will make "with_finally" and "with_catch" obsolete, which should be marked as deprecated in the not-to-far future.
- Switches:
- -auto_abort (optional, boolean, defaults to
"true"
)- Parameters:
- body (required)
- See Also:
- with_finally
- with_catch
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- create_form_with_form_instance
ad_unless_script_abort (public)
ad_unless_script_abort body non_abort_action
Execute the provided body in the callers' environment. When the body does not raise an "ad_script_abort" exception, the "non_abort_action" is also executed. This pattern is useful when handling client requests and where the "non_abort_action" is used to return results to the client. When "ad_script_abort" is executed, the connection is usually closed, and any attempt to talk to the client over the closed connection will fail. The handling of script_abort exceptions is done usually in the request processor. The function is useful when registering own request procs (e.g., via "ns_register_proc") where the OpenACS request processor is not involved.
- Parameters:
- body (required)
- script, which is always executed
- non_abort_action (required)
- script, which is executed unless the body was aborted.
- See Also:
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.