Liking cljdoc? Tell your friends :D

de.otto.nom.core


abominable?clj/smultimethod

Is the argument something that should be treated as an anomaly?

Is the argument something that should be treated as an anomaly?
sourceraw docstring

adaptclj/smultimethod

Convert the argument to a nom/anomaly.

Convert the argument to a nom/anomaly.
sourceraw docstring

anomaly?clj/s

(anomaly? a)

Predicate for anomalies.

Predicate for anomalies.
sourceraw docstring

cl-find-ifclj/s

(cl-find-if pred
            coll
            &
            {:keys [from-end start end key]
             :or {from-end false start 0 end nil key identity}})
source

cognitect-anomaly?clj/s

(cognitect-anomaly? a)
source

failclj/s

(fail category & more)

Construct a new anomaly with the given category. Accepts either keyword arguments or a map with further data. Example: (= [::anomaly :nonono {:foo 1 :bar 2}] (fail :nonono :foo 1 :bar 2) (fail :nonono {:foo 1 :bar 2}))

Construct a new anomaly with the given `category`.  Accepts either keyword
arguments or a map with further data.
Example: (= [::anomaly :nonono {:foo 1 :bar 2}]
            (fail :nonono :foo 1 :bar 2)
            (fail :nonono {:foo 1 :bar 2}))
sourceraw docstring

kindclj/s

(kind a)

The kind of an anomaly.

The kind of an anomaly.
sourceraw docstring

let-nomclj/smacro

(let-nom bindings & body)

Like a let, but each binding is made anomaly-propagating with nom. Any binding that assigns to a single symbol whose name starts with an underscore is treated as a guard. If the form in a guard is a vector, its constituent forms are checked one-by-one as in with-nom. If a guard finds an anomaly, the bindings short-circuit at that point, so no further binding nor the body are executed, and the value of the entire let-nom form is that anomaly. This means that if you want to recover from an anomaly in the body, you should not use guards.

Like a `let`, but each binding is made anomaly-propagating with `nom`.  Any
binding that assigns to a single symbol whose name starts with an underscore
is treated as a guard.  If the form in a guard is a vector, its constituent
forms are checked one-by-one as in `with-nom`.  If a guard finds an anomaly,
the bindings short-circuit at that point, so no further binding nor the body
are executed, and the value of the entire `let-nom` form is that anomaly.
This means that if you want to recover from an anomaly in the body, you should
not use guards.
sourceraw docstring

let-nom>clj/smacro

(let-nom> bindings & body)

Like let-nom, but any binding of an anomaly short-circuits, so that no further binding nor the body are executed, and the value of the entire let-nom> form is that anomaly. This means that you cannot recover in the body from anomalies in the bindings.

Like `let-nom`, but any binding of an anomaly short-circuits, so that no
further binding nor the body are executed, and the value of the entire
`let-nom>` form is that anomaly.  This means that you cannot recover in the
body from anomalies in the bindings.
sourceraw docstring

nomclj/smacro

(nom & forms)

Macro version of nom*. Checks all the values given in the form. If any value is an anomaly, returns that anomaly. Otherwise, evaluate the rest of the form (without the nom).

Example: (nom foo bar) — if any of nom, foo, or bar is an anomaly, returns that; otherwise calls and returns (foo bar).

Because this is a macro that expands to a conditional and the wrapped form, arities are checked normally by compiler and runtime.

Macro version of `nom*`.  Checks all the values given in the form.  If any
value is an anomaly, returns that anomaly.  Otherwise, evaluate the rest of
the form (without the `nom`).

Example: (nom foo bar) — if any of nom, foo, or bar is an anomaly, returns
that; otherwise calls and returns (foo bar).

Because this is a macro that expands to a conditional and the wrapped form,
arities are checked normally by compiler and runtime.
sourceraw docstring

nom*clj/s

(nom* f & args)

Takes a function f and arguments args for it. Checks all args. If any of them is an anomaly, returns that. Otherwise, returns the result of applying f on args.

Takes a function `f` and arguments `args` for it.  Checks all `args`.  If any
of them is an anomaly, returns that.  Otherwise, returns the result of
applying `f` on `args`.
sourceraw docstring

nom->clj/smacro

(nom-> form & forms)

Like some->, but instead of nil short-circuits on any anomaly.

Like `some->`, but instead of `nil` short-circuits on any anomaly.
sourceraw docstring

nom->>clj/smacro

(nom->> form & forms)

Like some->>, but instead of nil short-circuits on any anomaly.

Like `some->>`, but instead of `nil` short-circuits on any anomaly.
sourceraw docstring

payloadclj/s

(payload a)

The payload of an anomaly.

The payload of an anomaly.
sourceraw docstring

some-abominationclj/s

(some-abomination x)

Returns an anomaly from x if it is an anomaly or abominable, else nil.

Returns an anomaly from x if it is an anomaly or abominable, else nil.
sourceraw docstring

throw-anomalyclj/s

(throw-anomaly x)

Throws an ExceptionInfo in Clojure and js/Error in ClojureScript when an anomaly occurs in x, with anomaly kind as exception/error message and anomaly payload as exception/error data.

Usage:

(throw-anomaly (fail :something-not-found {:status 404 :msg "not found"})) ; => Execution error (ExceptionInfo) at ... ; => Anomaly returned: something-not-found

Throws an ExceptionInfo in Clojure and js/Error in ClojureScript when an anomaly occurs in `x`, with anomaly kind as
exception/error message and anomaly payload as exception/error data.

Usage:

(throw-anomaly (fail :something-not-found {:status 404 :msg "not found"}))
; => Execution error (ExceptionInfo) at ...
; => Anomaly returned: something-not-found
sourceraw docstring

try-nomclj/smacro

(try-nom & body)
source

with-defaultclj/smacro

(with-default [v form] & body)

Evaluates form and returns the result, unless it is an anomaly, in which case the anomaly is bound (possibly destructured) to v, the body evaluated, and that returned.

Evaluates `form` and returns the result, unless it is an anomaly, in which case
the anomaly is bound (possibly destructured) to `v`, the body evaluated, and
that returned.
sourceraw docstring

with-nomclj/smacro

(with-nom vs & body)

Takes a vector of forms to check and a body. If any of the checked forms returns an anomaly, the rest of the forms and the body are not executed and the anomaly returned.

Takes a vector of forms to check and a body.  If any of the checked forms
returns an anomaly, the rest of the forms and the body are not executed and
the anomaly returned.
sourceraw docstring

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

× close