retry function to return the error
Mike-Hanna opened this issue · comments
It would be useful if there is a way to return the error instead of "maximum number of tries exceeded". I'm passing a regex expression ".*"
to the when
argument and would like to capture the error itself. Thank you!
Each trial might have a different error message, should we only raise the last error message when timeout or max #try reaches.?
Can you create an error list with the first error, then append each error to the list and return the list after the last retry?
I just ran into this myself. It would be really helpful for remote logging and debugging. I've started to look at the code, but will need more to grok – it is quite elegant-yet-dense meta-programming!
As a workaround, I've been adding the retry itself within a try() and rerunning the bare function to expose the error. It looks terrible, but it gets me the underlying error.
As for the design — a list of errors sounds good. It is useful to know if the function is failing in different ways.