mirror of
https://github.com/actions/setup-node.git
synced 2026-02-24 07:44:51 +08:00
error
This commit is contained in:
@@ -108,9 +108,22 @@ export default abstract class BaseDistribution {
|
||||
const initialUrl = this.getDistributionUrl();
|
||||
|
||||
const dataUrl = `${initialUrl}/index.json`;
|
||||
|
||||
try {
|
||||
const response = await this.httpClient.getJson<INodeVersion[]>(dataUrl);
|
||||
return response.result || [];
|
||||
}catch (err) {
|
||||
if (err instanceof Error && err.message.includes('getaddrinfo EAI_AGAIN')) {
|
||||
core.error(`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) {
|
||||
core.error(`404 Error: Unable to find versions at ${dataUrl}.
|
||||
Please verify that the mirror URL is valid.`);
|
||||
} else {
|
||||
core.error(`Failed to fetch Node.js versions from ${dataUrl}.
|
||||
Please check the URL and try again.}`);
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
protected getNodejsDistInfo(version: string) {
|
||||
|
||||
Reference in New Issue
Block a user