Skip to content

Commit

Permalink
feat: Improve logging during retry attempts
Browse files Browse the repository at this point in the history
  • Loading branch information
rhyslbw committed Aug 5, 2020
1 parent 705036b commit a2f6e9b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions packages/util/src/onFailedAttemptFor.ts
Expand Up @@ -2,6 +2,7 @@ import { FailedAttemptError } from 'p-retry'

export const onFailedAttemptFor = (operation: string) => ({ attemptNumber, message, retriesLeft }: FailedAttemptError) => {
const nextAction = retriesLeft > 0 ? 'retying...' : 'exiting'
console.warn(message)
console.log(`${operation}: Attempt ${attemptNumber} of ${attemptNumber + retriesLeft}, ${nextAction}`)
if (retriesLeft === 0) {
console.error(message)
Expand Down

0 comments on commit a2f6e9b

Please sign in to comment.