(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 builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |