From ccdde36f48366b634fe194979df2125d5c2d1577 Mon Sep 17 00:00:00 2001 From: "Mark S. Miller" Date: Tue, 12 Aug 2025 13:26:30 -0700 Subject: [PATCH 1/7] util: add remaining errors to wellKnownPrototypes --- lib/internal/util/inspect.js | 28 ++++++++++++++++++++++++++++ typings/primordials.d.ts | 2 ++ 2 files changed, 30 insertions(+) diff --git a/lib/internal/util/inspect.js b/lib/internal/util/inspect.js index 375a0091209161..9a4c2aed0704b3 100644 --- a/lib/internal/util/inspect.js +++ b/lib/internal/util/inspect.js @@ -30,9 +30,27 @@ const { DatePrototypeGetTime, DatePrototypeToISOString, DatePrototypeToString, + Error, ErrorPrototype, ErrorPrototypeToString, + AggregateError, + AggregateErrorPrototype, + EvalError, + EvalErrorPrototype, + RangeError, + RangeErrorPrototype, + ReferenceError, + ReferenceErrorPrototype, + // SuppressedError, + // SuppressedErrorPrototype, + SyntaxError, + SyntaxErrorPrototype, + TypeError, + TypeErrorPrototype, + URIError, + URIErrorPrototype, + Function, FunctionPrototype, FunctionPrototypeBind, @@ -636,7 +654,17 @@ const wellKnownPrototypes = new SafeMap() .set(RegExpPrototype, { name: 'RegExp', constructor: RegExp }) .set(DatePrototype, { name: 'Date', constructor: Date }) .set(DataViewPrototype, { name: 'DataView', constructor: DataView }) + .set(ErrorPrototype, { name: 'Error', constructor: Error }) + .set(AggregateErrorPrototype, { name: 'AggregateError', constructor: AggregateError }) + .set(EvalErrorPrototype, { name: 'EvalError', constructor: EvalError }) + .set(RangeErrorPrototype, { name: 'RangeError', constructor: RangeError }) + .set(ReferenceErrorPrototype, { name: 'ReferenceError', constructor: ReferenceError }) + // .set(SuppressedErrorPrototype, { name: 'SuppressedError', constructor: SuppressedError }) + .set(SyntaxErrorPrototype, { name: 'SyntaxError', constructor: SyntaxError }) + .set(TypeErrorPrototype, { name: 'TypeError', constructor: TypeError }) + .set(URIErrorPrototype, { name: 'URIError', constructor: URIError }) + .set(BooleanPrototype, { name: 'Boolean', constructor: Boolean }) .set(NumberPrototype, { name: 'Number', constructor: Number }) .set(StringPrototype, { name: 'String', constructor: String }) diff --git a/typings/primordials.d.ts b/typings/primordials.d.ts index d340225f554eac..5ab27f23a28c6d 100644 --- a/typings/primordials.d.ts +++ b/typings/primordials.d.ts @@ -428,6 +428,8 @@ declare namespace primordials { export const StringPrototypeToWellFormed: UncurryThis export const StringPrototypeValueOf: UncurryThis export const StringPrototypeReplaceAll: UncurryThis + // export import SuppressedError = globalThis.SuppressedError; + // export const SuppressedErrorPrototype: typeof SuppressedError.prototype; export import Symbol = globalThis.Symbol; export const SymbolPrototype: typeof Symbol.prototype export const SymbolFor: typeof Symbol.for From be7fd9ede6498d06d238ac9d10f185b681958fab Mon Sep 17 00:00:00 2001 From: "Mark S. Miller" Date: Tue, 12 Aug 2025 14:49:45 -0700 Subject: [PATCH 2/7] fixup! alphabetize primordials --- lib/internal/util/inspect.js | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/lib/internal/util/inspect.js b/lib/internal/util/inspect.js index 9a4c2aed0704b3..22d834070ea358 100644 --- a/lib/internal/util/inspect.js +++ b/lib/internal/util/inspect.js @@ -1,6 +1,8 @@ 'use strict'; const { + AggregateError, + AggregateErrorPrototype, Array, ArrayBuffer, ArrayBufferPrototype, @@ -30,27 +32,11 @@ const { DatePrototypeGetTime, DatePrototypeToISOString, DatePrototypeToString, - Error, ErrorPrototype, ErrorPrototypeToString, - AggregateError, - AggregateErrorPrototype, EvalError, EvalErrorPrototype, - RangeError, - RangeErrorPrototype, - ReferenceError, - ReferenceErrorPrototype, - // SuppressedError, - // SuppressedErrorPrototype, - SyntaxError, - SyntaxErrorPrototype, - TypeError, - TypeErrorPrototype, - URIError, - URIErrorPrototype, - Function, FunctionPrototype, FunctionPrototypeBind, @@ -92,6 +78,10 @@ const { ObjectSetPrototypeOf, Promise, PromisePrototype, + RangeError, + RangeErrorPrototype, + ReferenceError, + ReferenceErrorPrototype, ReflectApply, ReflectOwnKeys, RegExp, @@ -127,16 +117,24 @@ const { StringPrototypeToLowerCase, StringPrototypeTrim, StringPrototypeValueOf, + // SuppressedError, + // SuppressedErrorPrototype, SymbolIterator, SymbolPrototypeToString, SymbolPrototypeValueOf, SymbolToPrimitive, SymbolToStringTag, + SyntaxError, + SyntaxErrorPrototype, TypedArray, TypedArrayPrototype, TypedArrayPrototypeGetLength, TypedArrayPrototypeGetSymbolToStringTag, + TypeError, + TypeErrorPrototype, Uint8Array, + URIError, + URIErrorPrototype, WeakMap, WeakMapPrototype, WeakSet, From 3f67f990f1323aa26223a04141272cefa9ff7fef Mon Sep 17 00:00:00 2001 From: "Mark S. Miller" Date: Tue, 12 Aug 2025 15:07:24 -0700 Subject: [PATCH 3/7] fixup! alphabetize primordials --- lib/internal/util/inspect.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/internal/util/inspect.js b/lib/internal/util/inspect.js index 22d834070ea358..8e730d6f0666bd 100644 --- a/lib/internal/util/inspect.js +++ b/lib/internal/util/inspect.js @@ -126,15 +126,15 @@ const { SymbolToStringTag, SyntaxError, SyntaxErrorPrototype, + TypeError, + TypeErrorPrototype, TypedArray, TypedArrayPrototype, TypedArrayPrototypeGetLength, TypedArrayPrototypeGetSymbolToStringTag, - TypeError, - TypeErrorPrototype, - Uint8Array, URIError, URIErrorPrototype, + Uint8Array, WeakMap, WeakMapPrototype, WeakSet, From 0e8162fd2d04650e83f177782df7ca8f926781be Mon Sep 17 00:00:00 2001 From: "Mark S. Miller" Date: Tue, 12 Aug 2025 15:51:10 -0700 Subject: [PATCH 4/7] fixup! review suggestion --- lib/internal/util/inspect.js | 2 ++ typings/primordials.d.ts | 1 + 2 files changed, 3 insertions(+) diff --git a/lib/internal/util/inspect.js b/lib/internal/util/inspect.js index 8e730d6f0666bd..42cac5f5a7463b 100644 --- a/lib/internal/util/inspect.js +++ b/lib/internal/util/inspect.js @@ -117,6 +117,7 @@ const { StringPrototypeToLowerCase, StringPrototypeTrim, StringPrototypeValueOf, + // TODO for when Node supports SuppressedError // SuppressedError, // SuppressedErrorPrototype, SymbolIterator, @@ -658,6 +659,7 @@ const wellKnownPrototypes = new SafeMap() .set(EvalErrorPrototype, { name: 'EvalError', constructor: EvalError }) .set(RangeErrorPrototype, { name: 'RangeError', constructor: RangeError }) .set(ReferenceErrorPrototype, { name: 'ReferenceError', constructor: ReferenceError }) + // TODO for when Node supports SuppressedError // .set(SuppressedErrorPrototype, { name: 'SuppressedError', constructor: SuppressedError }) .set(SyntaxErrorPrototype, { name: 'SyntaxError', constructor: SyntaxError }) .set(TypeErrorPrototype, { name: 'TypeError', constructor: TypeError }) diff --git a/typings/primordials.d.ts b/typings/primordials.d.ts index 5ab27f23a28c6d..83977d82289ddb 100644 --- a/typings/primordials.d.ts +++ b/typings/primordials.d.ts @@ -428,6 +428,7 @@ declare namespace primordials { export const StringPrototypeToWellFormed: UncurryThis export const StringPrototypeValueOf: UncurryThis export const StringPrototypeReplaceAll: UncurryThis + // TODO for when Node supports SuppressedError // export import SuppressedError = globalThis.SuppressedError; // export const SuppressedErrorPrototype: typeof SuppressedError.prototype; export import Symbol = globalThis.Symbol; From 12f40ca2f54c683918ea4fe042b73266ff9e29c2 Mon Sep 17 00:00:00 2001 From: "Mark S. Miller" Date: Wed, 13 Aug 2025 20:07:13 -0700 Subject: [PATCH 5/7] Review suggestion change TODO comment Co-authored-by: Antoine du Hamel --- lib/internal/util/inspect.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/internal/util/inspect.js b/lib/internal/util/inspect.js index 42cac5f5a7463b..d8d012daf9aafd 100644 --- a/lib/internal/util/inspect.js +++ b/lib/internal/util/inspect.js @@ -117,9 +117,6 @@ const { StringPrototypeToLowerCase, StringPrototypeTrim, StringPrototypeValueOf, - // TODO for when Node supports SuppressedError - // SuppressedError, - // SuppressedErrorPrototype, SymbolIterator, SymbolPrototypeToString, SymbolPrototypeValueOf, From 18047bcd7f18cbbfecadbe805beabaa22b781c8d Mon Sep 17 00:00:00 2001 From: "Mark S. Miller" Date: Wed, 13 Aug 2025 20:07:32 -0700 Subject: [PATCH 6/7] Review suggestion change TODO comment Co-authored-by: Antoine du Hamel --- typings/primordials.d.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/typings/primordials.d.ts b/typings/primordials.d.ts index 83977d82289ddb..d340225f554eac 100644 --- a/typings/primordials.d.ts +++ b/typings/primordials.d.ts @@ -428,9 +428,6 @@ declare namespace primordials { export const StringPrototypeToWellFormed: UncurryThis export const StringPrototypeValueOf: UncurryThis export const StringPrototypeReplaceAll: UncurryThis - // TODO for when Node supports SuppressedError - // export import SuppressedError = globalThis.SuppressedError; - // export const SuppressedErrorPrototype: typeof SuppressedError.prototype; export import Symbol = globalThis.Symbol; export const SymbolPrototype: typeof Symbol.prototype export const SymbolFor: typeof Symbol.for From f24079e9086a5824bc59dd23e64b2c4cc11ce4d6 Mon Sep 17 00:00:00 2001 From: "Mark S. Miller" Date: Thu, 14 Aug 2025 12:29:35 -0700 Subject: [PATCH 7/7] fixup! remove addition of most errors --- lib/internal/util/inspect.js | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/lib/internal/util/inspect.js b/lib/internal/util/inspect.js index d8d012daf9aafd..691e4d71c99a0e 100644 --- a/lib/internal/util/inspect.js +++ b/lib/internal/util/inspect.js @@ -35,8 +35,6 @@ const { Error, ErrorPrototype, ErrorPrototypeToString, - EvalError, - EvalErrorPrototype, Function, FunctionPrototype, FunctionPrototypeBind, @@ -80,8 +78,6 @@ const { PromisePrototype, RangeError, RangeErrorPrototype, - ReferenceError, - ReferenceErrorPrototype, ReflectApply, ReflectOwnKeys, RegExp, @@ -122,16 +118,12 @@ const { SymbolPrototypeValueOf, SymbolToPrimitive, SymbolToStringTag, - SyntaxError, - SyntaxErrorPrototype, TypeError, TypeErrorPrototype, TypedArray, TypedArrayPrototype, TypedArrayPrototypeGetLength, TypedArrayPrototypeGetSymbolToStringTag, - URIError, - URIErrorPrototype, Uint8Array, WeakMap, WeakMapPrototype, @@ -653,14 +645,8 @@ const wellKnownPrototypes = new SafeMap() .set(ErrorPrototype, { name: 'Error', constructor: Error }) .set(AggregateErrorPrototype, { name: 'AggregateError', constructor: AggregateError }) - .set(EvalErrorPrototype, { name: 'EvalError', constructor: EvalError }) .set(RangeErrorPrototype, { name: 'RangeError', constructor: RangeError }) - .set(ReferenceErrorPrototype, { name: 'ReferenceError', constructor: ReferenceError }) - // TODO for when Node supports SuppressedError - // .set(SuppressedErrorPrototype, { name: 'SuppressedError', constructor: SuppressedError }) - .set(SyntaxErrorPrototype, { name: 'SyntaxError', constructor: SyntaxError }) .set(TypeErrorPrototype, { name: 'TypeError', constructor: TypeError }) - .set(URIErrorPrototype, { name: 'URIError', constructor: URIError }) .set(BooleanPrototype, { name: 'Boolean', constructor: Boolean }) .set(NumberPrototype, { name: 'Number', constructor: Number })