We are using the async-retry library, which seems to make a new retryOperation object, call attempt on it, and then call retry on it if needed. If it passes in an error to retry, it seems to rely on node-retry to add the error to the list of errors that's being kept.
However, when there is a timeout, the error passed in is dropped. In practice, this means that when something throws one error and then times out, the one error is never added to retryOperation._errors, so our code (which eventually receives operation.mainError()) gets the error message "RetryOperation timeout occurred".
What (this section hopefully won't change)
It would be nice if the error passed in to retry always made its way into the _errors array, so this wouldn't happen.
How (open to change)
We can copy line 53 and paste just above line 49. I would have made a PR but I couldn't figure out how to do it on this repo.
Why (this section hopefully won't change)
We are using the async-retry library, which seems to make a new retryOperation object, call
attempt
on it, and then callretry
on it if needed. If it passes in an error toretry
, it seems to rely on node-retry to add the error to the list of errors that's being kept.However, when there is a timeout, the error passed in is dropped. In practice, this means that when something throws one error and then times out, the one error is never added to
retryOperation._errors
, so our code (which eventually receivesoperation.mainError()
) gets the error message "RetryOperation timeout occurred".What (this section hopefully won't change)
It would be nice if the error passed in to
retry
always made its way into the_errors
array, so this wouldn't happen.How (open to change)
We can copy line 53 and paste just above line 49. I would have made a PR but I couldn't figure out how to do it on this repo.