GeezerVison is showing github.com — lib: legitimize `SuppressedError` as primordial · nodejs/node@d994210
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: lib/eslint.config_partial.mjs +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -23,7 +23,7 @@ const noRestrictedSyntax = [ | 23 | 23 | message: "`btoa` supports only latin-1 charset, use Buffer.from(str).toString('base64') instead", | 24 | 24 | }, | 25 | 25 | { | 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)$/])', | 27 | 27 | message: "Use an error exported by 'internal/errors' instead.", | 28 | 28 | }, | 29 | 29 | { | @@ -507,6 +507,7 @@ export default [ | 507 | 507 | into: 'Safe', | 508 | 508 | }, | 509 | 509 | { name: 'String' }, | | 510 | + { name: 'SuppressedError' }, | 510 | 511 | { name: 'Symbol' }, | 511 | 512 | { name: 'SyntaxError' }, | 512 | 513 | { name: 'TypeError' }, | |
Collapse file Copy file name to clipboardExpand all lines: lib/internal/quic/quic.js +1-2Lines changed: 1 addition & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -19,6 +19,7 @@ const { | 19 | 19 | PromisePrototypeThen, | 20 | 20 | PromiseWithResolvers, | 21 | 21 | SafeSet, | | 22 | + SuppressedError, | 22 | 23 | Symbol, | 23 | 24 | SymbolAsyncDispose, | 24 | 25 | SymbolAsyncIterator, | @@ -1231,14 +1232,12 @@ function invokeOnerror(fn, error) { | 1231 | 1232 | if (isPromise(result)) { | 1232 | 1233 | PromisePrototypeThen(result, undefined, (err) => { | 1233 | 1234 | process.nextTick(() => { | 1234 | | - // eslint-disable-next-line no-restricted-syntax | 1235 | 1235 | throw new SuppressedError(err, error, err?.message); | 1236 | 1236 | }); | 1237 | 1237 | }); | 1238 | 1238 | } | 1239 | 1239 | } catch (err) { | 1240 | 1240 | process.nextTick(() => { | 1241 | | - // eslint-disable-next-line no-restricted-syntax | 1242 | 1241 | throw new SuppressedError(err, error, err?.message); | 1243 | 1242 | }); | 1244 | 1243 | } | |
Collapse file Copy file name to clipboardExpand all lines: lib/internal/streams/iter/consumers.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -22,6 +22,7 @@ const { | 22 | 22 | PromisePrototypeThen, | 23 | 23 | SafePromiseAllReturnVoid, | 24 | 24 | SafeSet, | | 25 | + SuppressedError, | 25 | 26 | Symbol, | 26 | 27 | SymbolAsyncIterator, | 27 | 28 | TypedArrayPrototypeGetBuffer, | @@ -645,7 +646,6 @@ async function cleanupIterators(iterators, primaryError, pendingPulls) { | 645 | 646 | // Both a primary error and a cleanup error occurred. | 646 | 647 | // Wrap in SuppressedError so neither is lost: | 647 | 648 | // .error = primaryError, .suppressed = cleanupError. | 648 | | - // eslint-disable-next-line no-restricted-syntax | 649 | 649 | throw new SuppressedError(primaryError, cleanupError); | 650 | 650 | } | 651 | 651 | // No primary error - the cleanup error is the only error. | |
|