Skip to content

Commit

Permalink
fix: pRetry logFailure as warn
Browse files Browse the repository at this point in the history
  • Loading branch information
kirillgroshkov committed Aug 2, 2024
1 parent fd50c9e commit 1abdef2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/promise/pRetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,9 @@ export async function pRetry<T>(
return result
} catch (err) {
if (logFailures) {
logger.error(`${fname} attempt #${attempt} error in ${_since(started)}:`, err)
// Logger at warn (not error) level, because it's not a fatal error, but a retriable one
// Fatal one is not logged either, because it's been thrown instead
logger.warn(`${fname} attempt #${attempt} error in ${_since(started)}:`, err)
}

if (attempt >= maxAttempts || (predicate && !predicate(err as Error, attempt, maxAttempts))) {
Expand Down

0 comments on commit 1abdef2

Please sign in to comment.