Skip to content

Commit

Permalink
💩 [Debug] Include errors that occur during retries in throw error
Browse files Browse the repository at this point in the history
  • Loading branch information
sounisi5011 committed Jul 2, 2023
1 parent 9630d74 commit ed9f714
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/utils/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,23 @@ async function tryNpmConfigGet(key: string): Promise<string | null> {
// If the error is a segmentation fault, retry the "npm config get ..." command.
if (maybySegfaultError(firstError)) {
const SEGFAULT_RETRY = 5;
// ///// ↓DEBUG↓ /////
const errors = [];
// ///// ↑DEBUG↑ /////
for (let i = 0; i < SEGFAULT_RETRY; i++) {
try {
return await execNpmConfig();
} catch (error) {
if (!maybySegfaultError(error)) throw error;
// ///// ↓DEBUG↓ /////
errors.push(error);
// ///// ↑DEBUG↑ /////
}
}
// ///// ↓DEBUG↓ /////
if (firstError !== null && firstError !== undefined)
Object.assign(firstError, { otherErrors: errors });
// ///// ↑DEBUG↑ /////
}
throw firstError;
}
Expand Down

0 comments on commit ed9f714

Please sign in to comment.