Skip to content

Instantly share code, notes, and snippets.

@borkdude borkdude/human_errors.clj Secret
Last active Mar 21, 2018

Embed
What would you like to do?
Spec human errors
(s/fdef my-component
:args
(s/cat :opts
(s/and
(s/keys
:opt-un [::collapsed?
::collapsible?])
(fn
;; "Use either :collapsed or :collapsible?, but not both. This doesn't make sense."
[m]
(not (and (:collapsed m)
(:collapsible? m)))))))
;; vs.
(s/fdef my-component
:args
(s/cat :opts
(s/and
(s/keys
:opt-un [::collapsed?
::collapsible?])
(s/with-human-error
(fn [m]
;; these options are mutually exclusive
(not (and (:collapsed? m)
(:collapsible? m))))
(fn [_]
"Use either :collapsed or :collapsible?, but not both. This doesn't make sense.")))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.