(with-retry initial-bindings & body)
It's really inconvenient not being able to recur from within (catch) expressions. This macro wraps its body in a (loop [bindings] (try ...)). Provides a (retry & new bindings) form which is usable within (catch) blocks: when this form is returned by the body, the body will be retried with the new bindings. For instance,
(with-retry [attempts 5]
(network-request...)
(catch RequestFailed e
(if (< 1 attempts)
(retry (dec attempts))
(throw e))))
It's really inconvenient not being able to recur from within (catch) expressions. This macro wraps its body in a (loop [bindings] (try ...)). Provides a (retry & new bindings) form which is usable within (catch) blocks: when this form is returned by the body, the body will be retried with the new bindings. For instance, (with-retry [attempts 5] (network-request...) (catch RequestFailed e (if (< 1 attempts) (retry (dec attempts)) (throw e))))
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close