npm run format

This commit is contained in:
Aparna Jyothi 2025-02-28 16:16:00 +05:30
parent 5d5d8e9b58
commit 87063ef0ad
4 changed files with 16 additions and 15 deletions

View file

@ -13,7 +13,7 @@ import each from 'jest-each';
import * as main from '../src/main'; import * as main from '../src/main';
import * as util from '../src/util'; import * as util from '../src/util';
import OfficialBuilds from '../src/distributions/official_builds/official_builds'; import OfficialBuilds from '../src/distributions/official_builds/official_builds';
import { validateMirrorURL } from '../src/util'; import {validateMirrorURL} from '../src/util';
describe('main tests', () => { describe('main tests', () => {
let inputs = {} as any; let inputs = {} as any;
@ -284,8 +284,6 @@ describe('main tests', () => {
describe('mirror-url parameter', () => { describe('mirror-url parameter', () => {
beforeEach(() => { beforeEach(() => {
inputs['mirror-url'] = 'https://custom-mirror-url.com'; inputs['mirror-url'] = 'https://custom-mirror-url.com';
}); });
afterEach(() => { afterEach(() => {
@ -316,5 +314,4 @@ describe('main tests', () => {
); );
}); });
}); });
}); });

6
dist/setup/index.js vendored
View file

@ -100165,12 +100165,10 @@ class BaseDistribution {
catch (err) { catch (err) {
if (err instanceof Error && if (err instanceof Error &&
err.message.includes('getaddrinfo EAI_AGAIN')) { err.message.includes('getaddrinfo EAI_AGAIN')) {
core.setFailed(`Network error: Failed to resolve the server at ${dataUrl}. core.setFailed(`Network error: Failed to resolve the server at ${dataUrl}.Please check your DNS settings or verify that the URL is correct.`);
Please check your DNS settings or verify that the URL is correct.`);
} }
else if (err instanceof hc.HttpClientError && err.statusCode === 404) { else if (err instanceof hc.HttpClientError && err.statusCode === 404) {
core.setFailed(`404 Error: Unable to find versions at ${dataUrl}. core.setFailed(`404 Error: Unable to find versions at ${dataUrl}.Please verify that the mirror URL is valid.`);
Please verify that the mirror URL is valid.`);
} }
else { else {
core.setFailed(`Failed to fetch Node.js versions from ${dataUrl}.Please check the URL and try again.}`); core.setFailed(`Failed to fetch Node.js versions from ${dataUrl}.Please check the URL and try again.}`);

View file

@ -116,13 +116,17 @@ export default abstract class BaseDistribution {
err instanceof Error && err instanceof Error &&
err.message.includes('getaddrinfo EAI_AGAIN') err.message.includes('getaddrinfo EAI_AGAIN')
) { ) {
core.setFailed(`Network error: Failed to resolve the server at ${dataUrl}. core.setFailed(
Please check your DNS settings or verify that the URL is correct.`); `Network error: Failed to resolve the server at ${dataUrl}.Please check your DNS settings or verify that the URL is correct.`
);
} else if (err instanceof hc.HttpClientError && err.statusCode === 404) { } else if (err instanceof hc.HttpClientError && err.statusCode === 404) {
core.setFailed(`404 Error: Unable to find versions at ${dataUrl}. core.setFailed(
Please verify that the mirror URL is valid.`); `404 Error: Unable to find versions at ${dataUrl}.Please verify that the mirror URL is valid.`
);
} else { } else {
core.setFailed(`Failed to fetch Node.js versions from ${dataUrl}.Please check the URL and try again.}`); core.setFailed(
`Failed to fetch Node.js versions from ${dataUrl}.Please check the URL and try again.}`
);
} }
throw err; throw err;
} }

View file

@ -341,7 +341,9 @@ export default class OfficialBuilds extends BaseDistribution {
); );
} else { } else {
// For any other error type, you can log the error message. // For any other error type, you can log the error message.
core.setFailed(`An unexpected error occurred like url might not correct`); core.setFailed(
`An unexpected error occurred like url might not correct`
);
} }
throw error; throw error;