mirror of
https://github.com/opentofu/setup-opentofu.git
synced 2026-12-01 12:14:42 +01:00
feat(error-handling): error notification for network failures (#94)
Signed-off-by: hoivikaj <github@hoivik.co>
This commit is contained in:
1 parent
4959f8f18c
commit
b572e07b01
7 files changed
+335
-52
No files matched your search
Vendored
+126
-14
@@ -34394,6 +34394,83 @@ function _unique(values) {
|
|||||||
return Array.from(new Set(values));
|
return Array.from(new Set(values));
|
||||||
}
|
}
|
||||||
//# sourceMappingURL=tool-cache.js.map
|
//# sourceMappingURL=tool-cache.js.map
|
||||||
|
;// CONCATENATED MODULE: ./lib/error-utils.js
|
||||||
|
/**
|
||||||
|
* Copyright (c) OpenTofu
|
||||||
|
* SPDX-License-Identifier: MPL-2.0
|
||||||
|
*
|
||||||
|
* Normalizes errors (including AggregateError from fetch/undici) into
|
||||||
|
* a single, actionable message for GitHub Actions logs.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a user-friendly message from any error.
|
||||||
|
* - AggregateError: flattens error.errors so network/download causes are visible.
|
||||||
|
* - Standard Error: returns message; includes cause if present (Node 16+).
|
||||||
|
*
|
||||||
|
* @param {unknown} error - Caught value (Error, AggregateError, or other).
|
||||||
|
* @returns {string} Single-line message suitable for core.setFailed().
|
||||||
|
*/
|
||||||
|
function getErrorMessage (error) {
|
||||||
|
if (error instanceof AggregateError && Array.isArray(error.errors)) {
|
||||||
|
if (error.errors.length === 0) {
|
||||||
|
return 'AggregateError (one or more operations failed)';
|
||||||
|
}
|
||||||
|
const parts = error.errors.map((e) => (e && typeof e.message === 'string' ? e.message : String(e)));
|
||||||
|
const combined = parts.join('; ');
|
||||||
|
return combined || 'AggregateError (one or more operations failed)';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (error instanceof Error) {
|
||||||
|
if (error.cause instanceof Error) {
|
||||||
|
return `${error.message}: ${error.cause.message}`;
|
||||||
|
}
|
||||||
|
return error.message;
|
||||||
|
}
|
||||||
|
|
||||||
|
return String(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a detailed string for logging (e.g. core.debug or core.error).
|
||||||
|
* Includes stack and, for AggregateError, each nested error.
|
||||||
|
*
|
||||||
|
* @param {unknown} error - Caught value.
|
||||||
|
* @returns {string} Multi-line detail string.
|
||||||
|
*/
|
||||||
|
function getErrorDetail (error) {
|
||||||
|
const lines = [];
|
||||||
|
|
||||||
|
if (error instanceof AggregateError && Array.isArray(error.errors)) {
|
||||||
|
lines.push(`AggregateError (${error.errors.length} error(s)):`);
|
||||||
|
error.errors.forEach((e, i) => {
|
||||||
|
lines.push(` [${i + 1}] ${e instanceof Error ? e.message : String(e)}`);
|
||||||
|
if (e instanceof Error && e.stack) {
|
||||||
|
lines.push(e.stack.split('\n').map((l) => ' ' + l).join('\n'));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (error.stack) {
|
||||||
|
lines.push('Outer stack:');
|
||||||
|
lines.push(error.stack);
|
||||||
|
}
|
||||||
|
return lines.join('\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (error instanceof Error) {
|
||||||
|
lines.push(error.message);
|
||||||
|
if (error.stack) lines.push(error.stack);
|
||||||
|
if (error.cause) {
|
||||||
|
lines.push('Caused by:');
|
||||||
|
lines.push(getErrorDetail(error.cause));
|
||||||
|
}
|
||||||
|
return lines.join('\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
return String(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;// CONCATENATED MODULE: ./lib/releases.js
|
;// CONCATENATED MODULE: ./lib/releases.js
|
||||||
/**
|
/**
|
||||||
* Copyright (c) HashiCorp, Inc.
|
* Copyright (c) HashiCorp, Inc.
|
||||||
@@ -34404,6 +34481,7 @@ function _unique(values) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Build {
|
class Build {
|
||||||
constructor (version, name) {
|
constructor (version, name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
@@ -34441,7 +34519,13 @@ async function fetchReleases (githubToken) {
|
|||||||
Accept: 'application/json'
|
Accept: 'application/json'
|
||||||
};
|
};
|
||||||
|
|
||||||
const resp = await http.get(url, headers);
|
let resp;
|
||||||
|
try {
|
||||||
|
resp = await http.get(url, headers);
|
||||||
|
} catch (error) {
|
||||||
|
const cause = getErrorMessage(error);
|
||||||
|
throw new Error(`Failed to fetch OpenTofu releases from ${url}: ${cause}`);
|
||||||
|
}
|
||||||
|
|
||||||
if (resp.message.statusCode !== HttpCodes.OK) {
|
if (resp.message.statusCode !== HttpCodes.OK) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
@@ -34449,8 +34533,21 @@ async function fetchReleases (githubToken) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const body = await resp.readBody();
|
let body;
|
||||||
const releasesMeta = JSON.parse(body);
|
try {
|
||||||
|
body = await resp.readBody();
|
||||||
|
} catch (error) {
|
||||||
|
const cause = getErrorMessage(error);
|
||||||
|
throw new Error(`Failed to read releases response: ${cause}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
let releasesMeta;
|
||||||
|
try {
|
||||||
|
releasesMeta = JSON.parse(body);
|
||||||
|
} catch (error) {
|
||||||
|
const cause = getErrorMessage(error);
|
||||||
|
throw new Error(`Invalid releases JSON from ${url}: ${cause}`);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {Array}
|
* @type {Array}
|
||||||
@@ -34543,6 +34640,7 @@ async function getRelease (
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// __dirname is not available in ES modules, so we need to construct it ourselves
|
// __dirname is not available in ES modules, so we need to construct it ourselves
|
||||||
const setup_tofu_dirname = (0,external_path_namespaceObject.dirname)((0,external_url_namespaceObject.fileURLToPath)(import.meta.url));
|
const setup_tofu_dirname = (0,external_path_namespaceObject.dirname)((0,external_url_namespaceObject.fileURLToPath)(import.meta.url));
|
||||||
|
|
||||||
@@ -34567,7 +34665,13 @@ function mapOS (os) {
|
|||||||
|
|
||||||
async function downloadAndExtractCLI (url) {
|
async function downloadAndExtractCLI (url) {
|
||||||
core_debug(`Downloading OpenTofu CLI from ${url}`);
|
core_debug(`Downloading OpenTofu CLI from ${url}`);
|
||||||
const pathToCLIZip = await downloadTool(url);
|
let pathToCLIZip;
|
||||||
|
try {
|
||||||
|
pathToCLIZip = await downloadTool(url);
|
||||||
|
} catch (error) {
|
||||||
|
const cause = getErrorMessage(error);
|
||||||
|
throw new Error(`Failed to download OpenTofu from ${url}: ${cause}`);
|
||||||
|
}
|
||||||
|
|
||||||
if (!pathToCLIZip) {
|
if (!pathToCLIZip) {
|
||||||
throw new Error(`Unable to download OpenTofu from ${url}`);
|
throw new Error(`Unable to download OpenTofu from ${url}`);
|
||||||
@@ -34576,14 +34680,19 @@ async function downloadAndExtractCLI (url) {
|
|||||||
let pathToCLI;
|
let pathToCLI;
|
||||||
|
|
||||||
core_debug('Extracting OpenTofu CLI zip file');
|
core_debug('Extracting OpenTofu CLI zip file');
|
||||||
if ((0,external_os_namespaceObject.platform)().startsWith('win')) {
|
try {
|
||||||
core_debug(`OpenTofu CLI Download Path is ${pathToCLIZip}`);
|
if ((0,external_os_namespaceObject.platform)().startsWith('win')) {
|
||||||
const fixedPathToCLIZip = `${pathToCLIZip}.zip`;
|
core_debug(`OpenTofu CLI Download Path is ${pathToCLIZip}`);
|
||||||
await mv(pathToCLIZip, fixedPathToCLIZip);
|
const fixedPathToCLIZip = `${pathToCLIZip}.zip`;
|
||||||
core_debug(`Moved download to ${fixedPathToCLIZip}`);
|
await mv(pathToCLIZip, fixedPathToCLIZip);
|
||||||
pathToCLI = await extractZip(fixedPathToCLIZip);
|
core_debug(`Moved download to ${fixedPathToCLIZip}`);
|
||||||
} else {
|
pathToCLI = await extractZip(fixedPathToCLIZip);
|
||||||
pathToCLI = await extractZip(pathToCLIZip);
|
} else {
|
||||||
|
pathToCLI = await extractZip(pathToCLIZip);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
const cause = getErrorMessage(error);
|
||||||
|
throw new Error(`Failed to extract OpenTofu archive: ${cause}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
core_debug(`OpenTofu CLI path is ${pathToCLI}.`);
|
core_debug(`OpenTofu CLI path is ${pathToCLI}.`);
|
||||||
@@ -34745,7 +34854,7 @@ async function run () {
|
|||||||
}
|
}
|
||||||
return release;
|
return release;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core_error(error);
|
core_error(getErrorMessage(error));
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -34763,11 +34872,14 @@ async function run () {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
try {
|
try {
|
||||||
await setup_tofu();
|
await setup_tofu();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setFailed(error.message);
|
const message = getErrorMessage(error);
|
||||||
|
core_debug(getErrorDetail(error));
|
||||||
|
setFailed(message);
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
||||||
@@ -4,14 +4,17 @@
|
|||||||
* SPDX-License-Identifier: MPL-2.0
|
* SPDX-License-Identifier: MPL-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { setFailed } from '@actions/core';
|
import { setFailed, debug } from '@actions/core';
|
||||||
|
|
||||||
import setup from './lib/setup-tofu.js';
|
import setup from './lib/setup-tofu.js';
|
||||||
|
import { getErrorMessage, getErrorDetail } from './lib/error-utils.js';
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
try {
|
try {
|
||||||
await setup();
|
await setup();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setFailed(error.message);
|
const message = getErrorMessage(error);
|
||||||
|
debug(getErrorDetail(error));
|
||||||
|
setFailed(message);
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) OpenTofu
|
||||||
|
* SPDX-License-Identifier: MPL-2.0
|
||||||
|
*
|
||||||
|
* Normalizes errors (including AggregateError from fetch/undici) into
|
||||||
|
* a single, actionable message for GitHub Actions logs.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a user-friendly message from any error.
|
||||||
|
* - AggregateError: flattens error.errors so network/download causes are visible.
|
||||||
|
* - Standard Error: returns message; includes cause if present (Node 16+).
|
||||||
|
*
|
||||||
|
* @param {unknown} error - Caught value (Error, AggregateError, or other).
|
||||||
|
* @returns {string} Single-line message suitable for core.setFailed().
|
||||||
|
*/
|
||||||
|
function getErrorMessage (error) {
|
||||||
|
if (error instanceof AggregateError && Array.isArray(error.errors)) {
|
||||||
|
if (error.errors.length === 0) {
|
||||||
|
return 'AggregateError (one or more operations failed)';
|
||||||
|
}
|
||||||
|
const parts = error.errors.map((e) => (e && typeof e.message === 'string' ? e.message : String(e)));
|
||||||
|
const combined = parts.join('; ');
|
||||||
|
return combined || 'AggregateError (one or more operations failed)';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (error instanceof Error) {
|
||||||
|
if (error.cause instanceof Error) {
|
||||||
|
return `${error.message}: ${error.cause.message}`;
|
||||||
|
}
|
||||||
|
return error.message;
|
||||||
|
}
|
||||||
|
|
||||||
|
return String(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a detailed string for logging (e.g. core.debug or core.error).
|
||||||
|
* Includes stack and, for AggregateError, each nested error.
|
||||||
|
*
|
||||||
|
* @param {unknown} error - Caught value.
|
||||||
|
* @returns {string} Multi-line detail string.
|
||||||
|
*/
|
||||||
|
function getErrorDetail (error) {
|
||||||
|
const lines = [];
|
||||||
|
|
||||||
|
if (error instanceof AggregateError && Array.isArray(error.errors)) {
|
||||||
|
lines.push(`AggregateError (${error.errors.length} error(s)):`);
|
||||||
|
error.errors.forEach((e, i) => {
|
||||||
|
lines.push(` [${i + 1}] ${e instanceof Error ? e.message : String(e)}`);
|
||||||
|
if (e instanceof Error && e.stack) {
|
||||||
|
lines.push(e.stack.split('\n').map((l) => ' ' + l).join('\n'));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (error.stack) {
|
||||||
|
lines.push('Outer stack:');
|
||||||
|
lines.push(error.stack);
|
||||||
|
}
|
||||||
|
return lines.join('\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (error instanceof Error) {
|
||||||
|
lines.push(error.message);
|
||||||
|
if (error.stack) lines.push(error.stack);
|
||||||
|
if (error.cause) {
|
||||||
|
lines.push('Caused by:');
|
||||||
|
lines.push(getErrorDetail(error.cause));
|
||||||
|
}
|
||||||
|
return lines.join('\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
return String(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
export { getErrorMessage, getErrorDetail };
|
||||||
+23
-3
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
import { HttpClient, HttpCodes } from '@actions/http-client';
|
import { HttpClient, HttpCodes } from '@actions/http-client';
|
||||||
import semver from 'semver';
|
import semver from 'semver';
|
||||||
|
import { getErrorMessage } from './error-utils.js';
|
||||||
|
|
||||||
class Build {
|
class Build {
|
||||||
constructor (version, name) {
|
constructor (version, name) {
|
||||||
@@ -44,7 +45,13 @@ async function fetchReleases (githubToken) {
|
|||||||
Accept: 'application/json'
|
Accept: 'application/json'
|
||||||
};
|
};
|
||||||
|
|
||||||
const resp = await http.get(url, headers);
|
let resp;
|
||||||
|
try {
|
||||||
|
resp = await http.get(url, headers);
|
||||||
|
} catch (error) {
|
||||||
|
const cause = getErrorMessage(error);
|
||||||
|
throw new Error(`Failed to fetch OpenTofu releases from ${url}: ${cause}`);
|
||||||
|
}
|
||||||
|
|
||||||
if (resp.message.statusCode !== HttpCodes.OK) {
|
if (resp.message.statusCode !== HttpCodes.OK) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
@@ -52,8 +59,21 @@ async function fetchReleases (githubToken) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const body = await resp.readBody();
|
let body;
|
||||||
const releasesMeta = JSON.parse(body);
|
try {
|
||||||
|
body = await resp.readBody();
|
||||||
|
} catch (error) {
|
||||||
|
const cause = getErrorMessage(error);
|
||||||
|
throw new Error(`Failed to read releases response: ${cause}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
let releasesMeta;
|
||||||
|
try {
|
||||||
|
releasesMeta = JSON.parse(body);
|
||||||
|
} catch (error) {
|
||||||
|
const cause = getErrorMessage(error);
|
||||||
|
throw new Error(`Invalid releases JSON from ${url}: ${cause}`);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {Array}
|
* @type {Array}
|
||||||
|
|||||||
+22
-10
@@ -22,6 +22,7 @@ import {
|
|||||||
import { downloadTool, extractZip, find, cacheDir } from '@actions/tool-cache';
|
import { downloadTool, extractZip, find, cacheDir } from '@actions/tool-cache';
|
||||||
import { mv, cp, mkdirP } from '@actions/io';
|
import { mv, cp, mkdirP } from '@actions/io';
|
||||||
import { getRelease } from './releases.js';
|
import { getRelease } from './releases.js';
|
||||||
|
import { getErrorMessage } from './error-utils.js';
|
||||||
|
|
||||||
// __dirname is not available in ES modules, so we need to construct it ourselves
|
// __dirname is not available in ES modules, so we need to construct it ourselves
|
||||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||||
@@ -47,7 +48,13 @@ function mapOS (os) {
|
|||||||
|
|
||||||
async function downloadAndExtractCLI (url) {
|
async function downloadAndExtractCLI (url) {
|
||||||
debug(`Downloading OpenTofu CLI from ${url}`);
|
debug(`Downloading OpenTofu CLI from ${url}`);
|
||||||
const pathToCLIZip = await downloadTool(url);
|
let pathToCLIZip;
|
||||||
|
try {
|
||||||
|
pathToCLIZip = await downloadTool(url);
|
||||||
|
} catch (error) {
|
||||||
|
const cause = getErrorMessage(error);
|
||||||
|
throw new Error(`Failed to download OpenTofu from ${url}: ${cause}`);
|
||||||
|
}
|
||||||
|
|
||||||
if (!pathToCLIZip) {
|
if (!pathToCLIZip) {
|
||||||
throw new Error(`Unable to download OpenTofu from ${url}`);
|
throw new Error(`Unable to download OpenTofu from ${url}`);
|
||||||
@@ -56,14 +63,19 @@ async function downloadAndExtractCLI (url) {
|
|||||||
let pathToCLI;
|
let pathToCLI;
|
||||||
|
|
||||||
debug('Extracting OpenTofu CLI zip file');
|
debug('Extracting OpenTofu CLI zip file');
|
||||||
if (platform().startsWith('win')) {
|
try {
|
||||||
debug(`OpenTofu CLI Download Path is ${pathToCLIZip}`);
|
if (platform().startsWith('win')) {
|
||||||
const fixedPathToCLIZip = `${pathToCLIZip}.zip`;
|
debug(`OpenTofu CLI Download Path is ${pathToCLIZip}`);
|
||||||
await mv(pathToCLIZip, fixedPathToCLIZip);
|
const fixedPathToCLIZip = `${pathToCLIZip}.zip`;
|
||||||
debug(`Moved download to ${fixedPathToCLIZip}`);
|
await mv(pathToCLIZip, fixedPathToCLIZip);
|
||||||
pathToCLI = await extractZip(fixedPathToCLIZip);
|
debug(`Moved download to ${fixedPathToCLIZip}`);
|
||||||
} else {
|
pathToCLI = await extractZip(fixedPathToCLIZip);
|
||||||
pathToCLI = await extractZip(pathToCLIZip);
|
} else {
|
||||||
|
pathToCLI = await extractZip(pathToCLIZip);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
const cause = getErrorMessage(error);
|
||||||
|
throw new Error(`Failed to extract OpenTofu archive: ${cause}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
debug(`OpenTofu CLI path is ${pathToCLI}.`);
|
debug(`OpenTofu CLI path is ${pathToCLI}.`);
|
||||||
@@ -227,7 +239,7 @@ async function run () {
|
|||||||
}
|
}
|
||||||
return release;
|
return release;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logError(error);
|
logError(getErrorMessage(error));
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,62 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) OpenTofu
|
||||||
|
* SPDX-License-Identifier: MPL-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { getErrorMessage, getErrorDetail } from '../error-utils.js';
|
||||||
|
|
||||||
|
describe('error-utils', () => {
|
||||||
|
describe('getErrorMessage', () => {
|
||||||
|
it('returns message for standard Error', () => {
|
||||||
|
expect(getErrorMessage(new Error('Something failed'))).toBe('Something failed');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('includes cause for Error with cause (Node 16+)', () => {
|
||||||
|
const cause = new Error('Network timeout');
|
||||||
|
const err = new Error('Download failed');
|
||||||
|
err.cause = cause;
|
||||||
|
expect(getErrorMessage(err)).toBe('Download failed: Network timeout');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('flattens AggregateError into a single message', () => {
|
||||||
|
const err = new AggregateError(
|
||||||
|
[new Error('ECONNREFUSED'), new Error('getaddrinfo ENOTFOUND')],
|
||||||
|
'AggregateError'
|
||||||
|
);
|
||||||
|
const msg = getErrorMessage(err);
|
||||||
|
expect(msg).toContain('ECONNREFUSED');
|
||||||
|
expect(msg).toContain('getaddrinfo ENOTFOUND');
|
||||||
|
expect(msg).not.toBe('AggregateError');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('returns fallback for AggregateError with empty errors', () => {
|
||||||
|
const err = new AggregateError([], 'AggregateError');
|
||||||
|
expect(getErrorMessage(err)).toBe('AggregateError (one or more operations failed)');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('coerces non-Error to string', () => {
|
||||||
|
expect(getErrorMessage('oops')).toBe('oops');
|
||||||
|
expect(getErrorMessage(123)).toBe('123');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('getErrorDetail', () => {
|
||||||
|
it('includes stack for Error', () => {
|
||||||
|
const err = new Error('test');
|
||||||
|
const detail = getErrorDetail(err);
|
||||||
|
expect(detail).toContain('test');
|
||||||
|
expect(detail).toContain('Error');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('includes each nested error for AggregateError', () => {
|
||||||
|
const err = new AggregateError(
|
||||||
|
[new Error('A'), new Error('B')],
|
||||||
|
'AggregateError'
|
||||||
|
);
|
||||||
|
const detail = getErrorDetail(err);
|
||||||
|
expect(detail).toContain('A');
|
||||||
|
expect(detail).toContain('B');
|
||||||
|
expect(detail).toContain('2 error(s)');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
Generated
+22
-23
@@ -597,21 +597,21 @@
|
|||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/@emnapi/core": {
|
"node_modules/@emnapi/core": {
|
||||||
"version": "1.8.1",
|
"version": "1.9.0",
|
||||||
"resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.8.1.tgz",
|
"resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.9.0.tgz",
|
||||||
"integrity": "sha512-AvT9QFpxK0Zd8J0jopedNm+w/2fIzvtPKPjqyw9jwvBaReTTqPBk9Hixaz7KbjimP+QNz605/XnjFcDAL2pqBg==",
|
"integrity": "sha512-0DQ98G9ZQZOxfUcQn1waV2yS8aWdZ6kJMbYCJB3oUBecjWYO1fqJ+a1DRfPF3O5JEkwqwP1A9QEN/9mYm2Yd0w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@emnapi/wasi-threads": "1.1.0",
|
"@emnapi/wasi-threads": "1.2.0",
|
||||||
"tslib": "^2.4.0"
|
"tslib": "^2.4.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@emnapi/runtime": {
|
"node_modules/@emnapi/runtime": {
|
||||||
"version": "1.8.1",
|
"version": "1.9.0",
|
||||||
"resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.8.1.tgz",
|
"resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.9.0.tgz",
|
||||||
"integrity": "sha512-mehfKSMWjjNol8659Z8KxEMrdSJDDot5SXMq00dM8BN4o+CLNXQ0xH2V7EchNHV4RmbZLmmPdEaXZc5H2FXmDg==",
|
"integrity": "sha512-QN75eB0IH2ywSpRpNddCRfQIhmJYBCJ1x5Lb3IscKAL8bMnVAKnRg8dCoXbHzVLLH7P38N2Z3mtulB7W0J0FKw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
@@ -620,9 +620,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@emnapi/wasi-threads": {
|
"node_modules/@emnapi/wasi-threads": {
|
||||||
"version": "1.1.0",
|
"version": "1.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.0.tgz",
|
||||||
"integrity": "sha512-WI0DdZ8xFSbgMjR1sFsKABJ/C5OnRrjT06JXbZKexJGrDuPTzZdDYfFlsgcCXCyf+suG5QU2e/y1Wo2V/OapLQ==",
|
"integrity": "sha512-N10dEJNSsUx41Z6pZsXU8FjPjpBEplgH24sfkmITrBED1/U2Esum9F3lfLrMjKHHjmi557zQn7kR9R+XWXu5Rg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
@@ -1522,9 +1522,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/@types/node": {
|
"node_modules/@types/node": {
|
||||||
"version": "25.4.0",
|
"version": "25.5.0",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-25.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-25.5.0.tgz",
|
||||||
"integrity": "sha512-9wLpoeWuBlcbBpOY3XmzSTG3oscB6xjBEEtn+pYXTfhyXhIxC5FsBer2KTopBlvKEiW9l13po9fq+SJY/5lkhw==",
|
"integrity": "sha512-jp2P3tQMSxWugkCUKLRPVUpGaL5MVFwF8RDuSRztfwgN1wmqJeMSbKlnEtQqU8UrhTmzEmZdu2I6v2dpp7XIxw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -2204,9 +2204,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/baseline-browser-mapping": {
|
"node_modules/baseline-browser-mapping": {
|
||||||
"version": "2.10.0",
|
"version": "2.10.7",
|
||||||
"resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.0.tgz",
|
"resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.7.tgz",
|
||||||
"integrity": "sha512-lIyg0szRfYbiy67j9KN8IyeD7q7hcmqnJ1ddWmNt19ItGpNN64mnllmxUNFIOdOm6by97jlL6wfpTTJrmnjWAA==",
|
"integrity": "sha512-1ghYO3HnxGec0TCGBXiDLVns4eCSx4zJpxnHrlqFQajmhfKMQBzUGDdkMK7fUW7PTHTeLf+j87aTuKuuwWzMGw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"bin": {
|
"bin": {
|
||||||
@@ -2320,9 +2320,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/caniuse-lite": {
|
"node_modules/caniuse-lite": {
|
||||||
"version": "1.0.30001777",
|
"version": "1.0.30001778",
|
||||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001777.tgz",
|
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001778.tgz",
|
||||||
"integrity": "sha512-tmN+fJxroPndC74efCdp12j+0rk0RHwV5Jwa1zWaFVyw2ZxAuPeG8ZgWC3Wz7uSjT3qMRQ5XHZ4COgQmsCMJAQ==",
|
"integrity": "sha512-PN7uxFL+ExFJO61aVmP1aIEG4i9whQd4eoSCebav62UwDyp5OHh06zN4jqKSMePVgxHifCw1QJxdRkA1Pisekg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@@ -2577,9 +2577,9 @@
|
|||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/electron-to-chromium": {
|
"node_modules/electron-to-chromium": {
|
||||||
"version": "1.5.307",
|
"version": "1.5.313",
|
||||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.307.tgz",
|
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.313.tgz",
|
||||||
"integrity": "sha512-5z3uFKBWjiNR44nFcYdkcXjKMbg5KXNdciu7mhTPo9tB7NbqSNP2sSnGR+fqknZSCwKkBN+oxiiajWs4dT6ORg==",
|
"integrity": "sha512-QBMrTWEf00GXZmJyx2lbYD45jpI3TUFnNIzJ5BBc8piGUDwMPa1GV6HJWTZVvY/eiN3fSopl7NRbgGp9sZ9LTA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "ISC"
|
"license": "ISC"
|
||||||
},
|
},
|
||||||
@@ -6617,7 +6617,6 @@
|
|||||||
"version": "0.0.6",
|
"version": "0.0.6",
|
||||||
"resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz",
|
"resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz",
|
||||||
"integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==",
|
"integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==",
|
||||||
"license": "MIT",
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.6.11 <=0.7.0 || >=0.7.3"
|
"node": ">=0.6.11 <=0.7.0 || >=0.7.3"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user