Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use callback to trigger early return
This commit merges the exception predicate functionality into the existing attempt callback function: if the callback returns `:again.core/fail` the remaining execution attempts are skipped and `with-retries` rethrows the last exception. A few notes on this: On second thought adding a second callback function (`exception-predicate`) seemed like a bad design choice since to make the predicate more general it would have required the same arguments as the existing `callback` function. At which point it made sense to just enhance the existing callback functionality. I decided to use a namespaced keyword (`:again.core/fail`) to signal the early return: 1. there is no (or at least very little) risk of any existing callback function out in the wild already returning that value, whereas `true` / `false` / `:fail` / `…` might be returned by an existing callback function accidentally 2. a keyword instead of `true` / `false` allows us to later add other functionality by returning other keywords
- Loading branch information
Showing
3 changed files
with
143 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters