Make reaction with error always throw on deref

This commit is contained in:
Dan Holmsand 2016-04-30 13:56:00 +02:00
parent d776b88113
commit 995acb6c34
2 changed files with 3 additions and 2 deletions

View File

@ -391,9 +391,10 @@
(doseq [w (s/difference old new)]
(-remove-watch w this))))
(_try-run [this other]
(_try-run [this]
(when (and dirty? (some? watching))
(try
(set! caught nil)
(._run this)
(catch :default e
(set! state e)
@ -431,7 +432,6 @@
IDeref
(-deref [this]
(when-some [e caught]
(set! caught nil)
(throw e))
(let [non-reactive (nil? *ratom-context*)]
(when non-reactive

View File

@ -365,6 +365,7 @@
(swap! state inc)
(rv/flush!))))
(is (= @count 2))
(is (thrown? :default @ref))
(swap! state inc)
(rv/flush!)
(is (= @count 3))