File tree Expand file tree Collapse file tree 2 files changed +3
-1
lines changed Expand file tree Collapse file tree 2 files changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -4244,7 +4244,8 @@ reduces them without incurring seq initialization"
4244
4244
(if (instance? Atom a)
4245
4245
(let [validate (.-validator a)]
4246
4246
(when-not (nil? validate)
4247
- (assert (validate new-value) " Validator rejected reference state" ))
4247
+ (when-not (validate new-value)
4248
+ (throw (js/Error. " Validator rejected reference state" ))))
4248
4249
(let [old-value (.-state a)]
4249
4250
(set! (.-state a) new-value)
4250
4251
(when-not (nil? (.-watches a))
Original file line number Diff line number Diff line change 743
743
(let [a (atom [1 ] :validator coll? :meta {:a 1 })]
744
744
(testing " Testing atom validators"
745
745
(is (= coll? (get-validator a)))
746
+ (is (thrown? js/Error (reset! a 1 )))
746
747
(is (= {:a 1 } (meta a)))
747
748
(alter-meta! a assoc :b 2 )
748
749
(is (= {:a 1 :b 2 } (meta a)))))
You can’t perform that action at this time.
0 commit comments