-
-
Save kindlychung/c05aa1c9ba9ac2b481f0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def sarah (atom {:name "Sarah" :age 25})) | |
(set-validator! sarah #(when-not (:age %) (throw (IllegalStateException. ":age required")))) |
You need to return true
(or a non-false val) if the state is acceptable. You could do this:
(set-validator! sarah #(if (:age %) true (throw (IllegalStateException. ":age required"))))
or this:
(set-validator! sarah #(:age %))
I see. Thanks a lot!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
CompilerException java.lang.IllegalStateException: Invalid reference state, compiling:(/Users/kaiyin/personal_config_bin_files/workspace/cina/src/cina/ref_types.clj:1:24)