Skip to content

Commit f35a972

Browse files
committed
refactor: rename function and add console error
1 parent 737b5af commit f35a972

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

packages/build/src/homebrew/generate-formula.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,19 @@ import type { GithubRepo } from '@mongodb-js/devtools-github-repo';
77
* what leads to receiving an EPIPE error from the OS, indicating the connection has already been closed.
88
* In such cases, retrying the request can help establish a new, functional connection.
99
*/
10-
async function getFileWithRetry(
10+
async function getFormulaFromRepositoryWithRetry(
1111
homebrewCore: GithubRepo,
1212
remainingRetries = 3
1313
) {
1414
try {
1515
return await homebrewCore.getFileContent('Formula/m/mongosh.rb', 'master');
1616
} catch (error: any) {
1717
if (error.message.includes('EPIPE') && remainingRetries > 0) {
18-
return await getFileWithRetry(homebrewCore, remainingRetries - 1);
18+
console.error(error);
19+
return await getFormulaFromRepositoryWithRetry(
20+
homebrewCore,
21+
remainingRetries - 1
22+
);
1923
} else {
2024
throw error;
2125
}
@@ -27,7 +31,7 @@ export async function generateUpdatedFormula(
2731
homebrewCore: GithubRepo,
2832
isDryRun: boolean
2933
): Promise<string | null> {
30-
const currentFormula = await getFileWithRetry(homebrewCore);
34+
const currentFormula = await getFormulaFromRepositoryWithRetry(homebrewCore);
3135

3236
const urlMatch = /url "([^"]+)"/g.exec(currentFormula.content);
3337
const shaMatch = /sha256 "([^"]+)"/g.exec(currentFormula.content);

0 commit comments

Comments
 (0)