Liking cljdoc? Tell your friends :D

failjure.core


assert-nil?clj

source

assert-not-empty?clj

source

assert-not-nil?clj

source

assert-number?clj

source

assert-some?clj

source

assert-withclj

(assert-with pred v msg)

If (pred v) is true, return v otherwise, return (f/fail msg)

If (pred v) is true, return v
otherwise, return (f/fail msg)
sourceraw docstring

attempt->cljmacro

(attempt-> start)
(attempt-> start form)
(attempt-> start form & forms)

Deprecated. Use ok-> instead.

Deprecated. Use ok-> instead.
sourceraw docstring

attempt->>cljmacro

(attempt->> start)
(attempt->> start form)
(attempt->> start form & forms)

Deprecated. Use ok->> instead.

Deprecated. Use ok->> instead.
sourceraw docstring

attempt-allcljmacro

(attempt-all bindings return)
(attempt-all bindings return else)

Used like let, but short-circuits in case of a failed binding. Can be used in combination with when-failed to handle the failure.

Unlike let, only accepts a single form to execute after the bindings.

(attempt-all [x "Ok" y (fail "Fail")] x (when-failed [e] (message e))) ; => "Fail"

Used like `let`, but short-circuits in case of
a failed binding. Can be used in combination with when-failed
to handle the failure.

Unlike `let`, only accepts a single form to execute after the bindings.

  (attempt-all [x "Ok"
                y (fail "Fail")]
    x
    (when-failed [e]
      (message e))) ; => "Fail"

sourceraw docstring

else*clj

(else* else-part result)
source

failclj

(fail msg)
(fail msg & fmt-parts)
source

HasFailedcljprotocol

failed?clj

(failed? self)

messageclj

(message self)
source

if-failedcljmacrodeprecated

(if-failed arglist & body)

DEPRECATED: Use when-failed instead

DEPRECATED: Use when-failed instead
sourceraw docstring

if-let-failed?cljmacro

(if-let-failed? [v-sym form] failed-branch)
(if-let-failed? [v-sym form] failed-branch ok-branch)

Inverse of if-let-ok?

(if-let-failed? [v (some-fn)] (prn "V Failed!") (prn "V is OK!"))

If called with 1 branch, returns the value in case of non-failure:

(if-let-failed? [v "Hello"] (prn "V Failed!")) ;; => returns "Hello"

Inverse of if-let-ok?

  (if-let-failed? [v (some-fn)]
    (prn "V Failed!")
    (prn "V is OK!"))

If called with 1 branch, returns the value in case of non-failure:

  (if-let-failed? [v "Hello"]
    (prn "V Failed!"))  ;; => returns "Hello"
sourceraw docstring

if-let-ok?cljmacro

(if-let-ok? [v-sym form] ok-branch)
(if-let-ok? [v-sym form] ok-branch failed-branch)

Binding convenience.

Acts just like let for non-failing values:

(if-let-ok? [v (something-which-may-fail)] (do-something-else v) (do-something-on-failure v))

Note that the value of v is the result of something-which-may-fail in either case. If no else branch is provided, nil is returned is returned:

(if-let-ok? [v (fail "Goodbye")] "Hello") ;; Returns #failjure.core.Failure{:message "Goodbye"}

Note that the above is identical in function to simply calling (fail "Goodbye")

Binding convenience.

Acts just like let for non-failing values:

  (if-let-ok? [v (something-which-may-fail)]
    (do-something-else v)
    (do-something-on-failure v))

Note that the value of v is the result of something-which-may-fail
in either case. If no else branch is provided, nil is returned
is returned:

  (if-let-ok? [v (fail "Goodbye")]
    "Hello")
  ;; Returns #failjure.core.Failure{:message "Goodbye"}

Note that the above is identical in function to simply calling
(fail "Goodbye")
sourceraw docstring

ok->cljmacro

(ok-> start & forms)

Like some->, but with ok? instead of some? (i.e., short-circuits when it encounters a failure)

Like some->, but with ok? instead of some?
(i.e., short-circuits when it encounters a failure)
sourceraw docstring

ok->>cljmacro

(ok->> start & forms)

Like some->>, but with ok? instead of some? (i.e., short-circuits when it encounters a failure)

Like some->>, but with ok? instead of some?
(i.e., short-circuits when it encounters a failure)
sourceraw docstring

ok?clj

(ok? v)
source

try*cljmacro

(try* & body)
source

when-failedcljmacro

(when-failed arglist & body)

Use in combination with attempt-all. If any binding in attempt-all failed, run the body given the failure/error as an argument.

Usage:

(attempt-all [_ (fail "Failure")] ; do something (when-failed [e] (print "ERROR:" (message e))))

Use in combination with `attempt-all`. If any binding in `attempt-all` failed,
 run the body given the failure/error as an argument.

Usage:

(attempt-all [_ (fail "Failure")]
  ; do something
  (when-failed [e]
    (print "ERROR:" (message e))))
sourceraw docstring

when-let-failed?cljmacro

(when-let-failed? [v-sym form] & failed-branches)

Inverse of when-let-ok?

(when-let-faild? [v (some-fn)] (prn "FAILED") (handle-failure v))

Returns the value in case of non-failure

Inverse of when-let-ok?

  (when-let-faild? [v (some-fn)]
    (prn "FAILED")
    (handle-failure v))

Returns the value in case of non-failure
sourceraw docstring

when-let-ok?cljmacro

(when-let-ok? [v-sym form] & ok-branches)

Analogous to if-let-ok? and when-let.

(when-let-ok? [v (some-fn)] (prn "WAS OK") (do-something v))

Returns the error in case of failure

Analogous to if-let-ok? and when-let.

  (when-let-ok? [v (some-fn)]
    (prn "WAS OK")
    (do-something v))

Returns the error in case of failure
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close