retry1.0.3Retry on some exceptions. dependencies
dev dependencies
| (this space intentionally left almost blank) | ||||||||||||||||||
A library to retry on some exceptions. | (ns retry.core {:author "Naitik Shah"} (:use [slingshot.slingshot :only [throw+ try+]])) | ||||||||||||||||||
Try and retry the given body if the given exception matched. | (defmacro try-times [retries exception-matcher & body] `(loop [retries# ~retries] (if-let [result# (try+ (do ~@body) (catch ~exception-matcher e# (when (zero? retries#) (throw+ e#))))] result# (recur (dec retries#))))) | ||||||||||||||||||
repl helpers | (ns retry.repl {:author "Naitik Shah"} (:require [auto-reload.core] [clojure.tools.logging]) (:use [retry.core :only [try-times]])) | ||||||||||||||||||
(auto-reload.core/auto-reload ["src"]) | |||||||||||||||||||