(call f & args)
Calls given function with supplied args in try/catch
block, then calls Catch.caught
on caught exception. If no exception has caught during function call returns its result
Calls given function with supplied args in `try/catch` block, then calls `Catch.caught` on caught exception. If no exception has caught during function call returns its result
(call-with catch-handler f & args)
Calls given function with supplied args in try/catch
block, then calls catch-handler on caught exception. If no exception has caught during function call returns its result
Calls given function with supplied args in `try/catch` block, then calls catch-handler on caught exception. If no exception has caught during function call returns its result
(caught t)
defines how to process caught exception
defines how to process caught exception
(chain v f & fs)
Passes given value through chain of functions. If value is an error or any function in chain returns error, it's returned and rest of chain is skipped
Passes given value through chain of functions. If value is an error or any function in chain returns error, it's returned and rest of chain is skipped
(else f value)
If value is an error, applies f to it, otherwise returns value
If value is an error, applies f to it, otherwise returns value
(else-call f value)
If value is an error, applies f to it wrapped to call
, otherwise returns value
If value is an error, applies f to it wrapped to `call`, otherwise returns value
(else-if err-class f value)
If value is an error of err-class (or any of its parents), applies f to it, otherwise returns value
If value is an error of err-class (or any of its parents), applies f to it, otherwise returns value
(fail)
(fail msg-or-data)
(fail msg data)
(fail msg data cause)
Calls ex-info
with given msg(optional, defaults to nil), data(optional, defaults to {}) and cause(optional, defaults to nil). Deprecated, use ex-info
instead
Calls `ex-info` with given msg(optional, defaults to nil), data(optional, defaults to {}) and cause(optional, defaults to nil). Deprecated, use `ex-info` instead
(fail! & args)
Constructs fail
with given args and throws it. Deprecated, use ex-info
with throw
instead
Constructs `fail` with given args and throws it. Deprecated, use `ex-info` with `throw` instead
(fail-with {:keys [msg data cause suppress? trace?]
:or {data {} suppress? false trace? false}
:as options})
Constructs Fail
with given options. Stacktrace is disabled by default
Constructs `Fail` with given options. Stacktrace is disabled by default
(fail-with! {:keys [trace?] :or {trace? true} :as options})
Constructs Fail
with given options and throws it. Stacktrace is enabled by default.
Constructs `Fail` with given options and throws it. Stacktrace is enabled by default.
(fail? t)
Checks if given value is considered as failure
Checks if given value is considered as failure
(flet bindings & body)
(flet &form &env bindings & body)
Flow adaptation of Clojure let
. Wraps evaluation of each binding to call-with
with default handler (defined with Catch.caught
). If value returned from binding evaluation is failure, it's returned immediately and all other bindings and body are skipped. Custom exception handler function may be passed as first binding with name :caught
Flow adaptation of Clojure `let`. Wraps evaluation of each binding to `call-with` with default handler (defined with `Catch.caught`). If value returned from binding evaluation is failure, it's returned immediately and all other bindings and body are skipped. Custom exception handler function may be passed as first binding with name `:caught`
(?err this f)
if value is an error, apply f to it, otherwise return value
if value is an error, apply f to it, otherwise return value
(?ok this f)
if value is not an error, apply f to it, otherwise return value
if value is not an error, apply f to it, otherwise return value
(then f value)
If value is not an error, applies f to it, otherwise returns value
If value is not an error, applies f to it, otherwise returns value
(then-call f value)
If value is not an error, applies f to it wrapped to call
, otherwise returns value
If value is not an error, applies f to it wrapped to `call`, otherwise returns value
(thru f value)
Applies f to value (for side effects). Returns value. Works similar to doto
, but accepts function as first arg
Applies f to value (for side effects). Returns value. Works similar to `doto`, but accepts function as first arg
(thru-call f value)
Applies f to value wrapped to call
(for side effects). Returns value. Works similar to doto
, but accepts function as first arg. Please not that exception thrown inside of function will be silently ignored by default
Applies f to value wrapped to `call` (for side effects). Returns value. Works similar to `doto`, but accepts function as first arg. Please not that exception thrown inside of function will be silently ignored by default
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close