PP
(def errors
{"Phone" :DUPLICATED_PHONE
"Email" :DUPLICATED_EMAIL})
(def matcher
(re-pattern
(apply str (interpose "|" (keys errors)))))
(defn error-id [msg]
(errors (re-find matcher msg)))
(error-id "Something with that Phone already exists")
Size: a a a
PP
(def errors
{"Phone" :DUPLICATED_PHONE
"Email" :DUPLICATED_EMAIL})
(def matcher
(re-pattern
(apply str (interpose "|" (keys errors)))))
(defn error-id [msg]
(errors (re-find matcher msg)))
(error-id "Something with that Phone already exists")
ST
(def errors
{"Phone" :DUPLICATED_PHONE
"Email" :DUPLICATED_EMAIL})
(defn- error-code
[^Throwable e, phrase]
(when (some-> e .getMessage (.contains phrase))
(errors phrase)))
(some (partial error-code e) (keys errors))
DL
MB
IG
IG
(s/def ::old/spec
(s/merge
::old/spec
(s/keys :req [:some/key
:another/key])))
IG
IG
KC
IG
KC

IS
KC
IS
ST
OR
OR
KC
ST
OR