(call f & args)
Calls given function with supplied args in try/catch
block, then calls ErrorHandling/handle
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 `ErrorHandling/handle` on caught exception. If no exception has caught during function call returns its result
(call-with handler f & args)
Calls given function with supplied args in try/catch
block, then calls 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 handler on caught exception. If no exception has caught during function call returns its result
(else f value)
If value is a fail?
, calls applies f to it, otherwise returns value
If value is a `fail?`, calls applies f to it, otherwise returns value
(else-call f value)
If value is a fail?
, applies f to it wrapped to call
, otherwise returns value
If value is a `fail?`, applies f to it wrapped to `call`, otherwise returns value
(else-if ex-class f value)
If value is an exception of ex-class, applies f to it, otherwise returns value
If value is an exception of ex-class, applies f to it, otherwise returns value
Defines behavior for handling each class of exceptions
Defines behavior for handling each class of exceptions
(handle t)
(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)
(fail? ex-class t)
Checks if value is exception of given class(optional, defaults to Throwable
)
Checks if value is exception of given class(optional, defaults to `Throwable`)
(flet bindings & body)
Flow adaptation of Clojure let
. Wraps evaluation of each binding to call-with
with default handler (defined with ErrorsHandling/handle
). If value returned from binding evaluation is fail?
, it's returned immediately and all other bindings and body are skipped. Custom exception handler function may be passed as first binding with name :handler
Flow adaptation of Clojure `let`. Wraps evaluation of each binding to `call-with` with default handler (defined with `ErrorsHandling/handle`). If value returned from binding evaluation is `fail?`, it's returned immediately and all other bindings and body are skipped. Custom exception handler function may be passed as first binding with name `:handler`
(then f value)
If value is not a fail?
, applies f to it, otherwise returns value
If value is not a `fail?`, applies f to it, otherwise returns value
(then-call f value)
If value is not a fail?
, applies f to it wrapped to call
, otherwise returns value
If value is not a `fail?`, 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