Closed devurandom closed 11 months ago
hi @devurandom the retry-block won't throw exception that is thrown in listener. If you want to throw an exeption when retry exceeded, just throw it in with-retry
, the exception of last attempt will be thrown.
Thanks! The fact that exceptions thrown in the :on-...
handlers do not make it out of the with-retry
block and are not even logged was unexpected. Is this documented and I just missed it?
In the end I achieved the desired behaviour with:
(deftest throw-on-timeout-test
(is (thrown-with-msg? Exception #"failure"
(or (dh/with-retry {:retry-when false
:delay-ms 100
:max-retries 10}
false)
(throw (ex-info "failure" {}))))))
This behaviour is actually from the underlying library failsafe. I can add some description in diehard's docs.
Exceptions thrown from :on-failure or :on-retries-exceeded are swallowed. As a result, the following test fails: