Close, but no cigar.

This commit is contained in:
Simon Brooke 2023-01-08 21:29:36 +00:00
parent 34847058fc
commit 98e3c7b4e7
No known key found for this signature in database
GPG key ID: A7A4F18D1D4DF987
5 changed files with 107 additions and 36 deletions

View file

@ -70,7 +70,7 @@
([x]
(try
(cond (string? x) (uri? (URI. x))
(map? x) (if (and (:type x) (:id x)) true false)
(map? x) true
:else false)
(catch URISyntaxException _ false)
(catch NullPointerException _ false)))
@ -228,11 +228,11 @@
;; i.e. there was at least one option that returned no faults...
(cons (make-fault-object severity-if-none token) faults))))
(defmacro cond-make-fault-object
(defn cond-make-fault-object
"If `v` is `false` or `nil`, return a fault object with this `severity` and `token`,
else return nil."
[v severity token]
`(when-not ~v (make-fault-object ~severity ~token)))
(when-not v (make-fault-object severity token)))
(defn string-or-fault
"If this `value` is not a string, return a fault object with this `severity`