Skip to content

Error Messages & Annotations

Replace left with fixed message.

(bend.label "expected integer" bend.int).get "hello"
# left "expected integer"

Wrap left with { path; got; }.

(bend.annotate ["user" "age"] bend.int).get "thirty"
# left { path = ["user" "age"]; got = "thirty"; }

Like annotate but f got computes the annotation.

Check predicate and label failure in one step.

(bend.ensure (s: s != "") "name cannot be empty" bend.str).get ""
# left "name cannot be empty"

Default error shape for named-step pipe: { path; got; }.

Contribute Community Sponsor