with_catch (public, deprecated)

 with_catch error_var body on_error

Defined in packages/acs-tcl/tcl/deprecated-procs.tcl

Deprecated. Invoking this procedure generates a warning.

execute code in body with the catch errorMessage in error_var and if there is a nonzero return code from body execute the on_error block. DEPRECATED: does not comply with OpenACS naming convention and can be replaced with better api such as ad_try or native Tcl constructs such as ::try (8.6)

Parameters:
error_var (required)
body (required)
on_error (required)
See Also:

Testcases:
No testcase defined.
Source code:
ad_log_deprecated proc with_catch
    upvar 1 $error_var $error_var
    if { [catch { uplevel $body } $error_var] } {
        set code [catch {uplevel $on_error} string]
        # Return out of the caller appropriately.
        if { $code == 1 } {
            return -code error -errorinfo $::errorInfo -errorcode $::errorCode $string
        } elseif$code == 2 } {
            return -code return $string
        } elseif$code == 3 } {
            return -code break
        } elseif$code == 4 } {
            return -code continue
        } elseif$code > 4 } {
            return -code $code $string
        }
    }
XQL Not present:
PostgreSQL, Oracle
Generic XQL file:
packages/acs-tcl/tcl/deprecated-procs.xql

[ hide source ] | [ make this the default ]
Show another procedure: