Skip to content

Commit 4b810e2

Browse files
LiviaMedeirosaduh95
authored andcommitted
lib: legitimize SuppressedError as primordial
Signed-off-by: LiviaMedeiros <livia@cirno.name> PR-URL: #67551 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
1 parent a5fd90f commit 4b810e2

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

‎lib/eslint.config_partial.mjs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const noRestrictedSyntax = [
2323
message: "`btoa` supports only latin-1 charset, use Buffer.from(str).toString('base64') instead",
2424
},
2525
{
26-
selector: 'NewExpression[callee.name=/Error$/]:not([callee.name=/^(AssertionError|NghttpError|AbortError|NodeAggregateError|QuicError|QuotaExceededError)$/])',
26+
selector: 'NewExpression[callee.name=/Error$/]:not([callee.name=/^(AssertionError|NghttpError|AbortError|NodeAggregateError|QuicError|QuotaExceededError|SuppressedError)$/])',
2727
message: "Use an error exported by 'internal/errors' instead.",
2828
},
2929
{
@@ -507,6 +507,7 @@ export default [
507507
into: 'Safe',
508508
},
509509
{ name: 'String' },
510+
{ name: 'SuppressedError' },
510511
{ name: 'Symbol' },
511512
{ name: 'SyntaxError' },
512513
{ name: 'TypeError' },

‎lib/internal/quic/quic.js‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const {
1919
PromisePrototypeThen,
2020
PromiseWithResolvers,
2121
SafeSet,
22+
SuppressedError,
2223
Symbol,
2324
SymbolAsyncDispose,
2425
SymbolAsyncIterator,
@@ -1231,14 +1232,12 @@ function invokeOnerror(fn, error) {
12311232
if (isPromise(result)) {
12321233
PromisePrototypeThen(result, undefined, (err) => {
12331234
process.nextTick(() => {
1234-
// eslint-disable-next-line no-restricted-syntax
12351235
throw new SuppressedError(err, error, err?.message);
12361236
});
12371237
});
12381238
}
12391239
} catch (err) {
12401240
process.nextTick(() => {
1241-
// eslint-disable-next-line no-restricted-syntax
12421241
throw new SuppressedError(err, error, err?.message);
12431242
});
12441243
}

‎lib/internal/streams/iter/consumers.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const {
2222
PromisePrototypeThen,
2323
SafePromiseAllReturnVoid,
2424
SafeSet,
25+
SuppressedError,
2526
Symbol,
2627
SymbolAsyncIterator,
2728
TypedArrayPrototypeGetBuffer,
@@ -645,7 +646,6 @@ async function cleanupIterators(iterators, primaryError, pendingPulls) {
645646
// Both a primary error and a cleanup error occurred.
646647
// Wrap in SuppressedError so neither is lost:
647648
// .error = primaryError, .suppressed = cleanupError.
648-
// eslint-disable-next-line no-restricted-syntax
649649
throw new SuppressedError(primaryError, cleanupError);
650650
}
651651
// No primary error - the cleanup error is the only error.

0 commit comments

Comments
 (0)