Skip to content

Commit

Permalink
winget-source: Fix retry printing logic
Browse files Browse the repository at this point in the history
response could be null in some cases (exceptions?), and printing response.url would make retry fail when this happens.
  • Loading branch information
taoky committed Jul 2, 2024
1 parent 2984024 commit de6d301
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion winget-source/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ const fetch = withRetry(originalFetch, {
if (attempt > 3) return false;

if (error || response.status >= 400) {
winston.warn(`retrying ${response.url} (${attempt})`);
if (response)
winston.warn(`retrying ${response.url} (${attempt})`);
else
winston.warn(`retrying (${attempt}, error: ${error})`);
return true;
}
}
Expand Down

0 comments on commit de6d301

Please sign in to comment.