Document await in exponential backoff run function
This commit is contained in:
@@ -90,6 +90,8 @@ export class ExponentialBackoff {
|
||||
|
||||
while (attempt < this.options.maxAttempts || unlimitedAttempts) {
|
||||
try {
|
||||
// Await the promise before returning so its execution context remains in the try-catch
|
||||
// If we didn't await, this `run` function would successfully return and any errors would not be caught here.
|
||||
return await taskFn();
|
||||
} catch (error) {
|
||||
// Store the error in case we fail every attempt
|
||||
|
||||
Reference in New Issue
Block a user