Whether an unknown value should be rendered as an Error rather than JSON.
A same-realm instanceof Error misses an Error created in another realm
(iframe / jsdom test env / worker error surface — the same class of object
data/loaders/abort-error.ts duck-types by name). Such an object stringifies
to {} because name/message/stack are non-enumerable, so the console
renderers drop its message unless they detect it structurally.
Two realm-proof signals, neither of which fires on an ordinary
{ name, message } data object:
a genuine Error (isGenuineError: instance or [[Class]] brand,
covering cross-realm Error and its subclasses);
failing that, the full string name + message + stack triple, which
a plain data object almost never carries (covers a structured-clone /
postMessage surface that is not an Error instance at all).
Never throws — same rationale as the other helpers here.
Whether an unknown value should be rendered as an Error rather than JSON.
A same-realm
instanceof Errormisses an Error created in another realm (iframe / jsdom test env / worker error surface — the same class of objectdata/loaders/abort-error.tsduck-types by name). Such an object stringifies to{}becausename/message/stackare non-enumerable, so the console renderers drop its message unless they detect it structurally.Two realm-proof signals, neither of which fires on an ordinary
{ name, message }data object:[[Class]]brand, covering cross-realmErrorand its subclasses);name+message+stacktriple, which a plain data object almost never carries (covers a structured-clone /postMessagesurface that is not anErrorinstance at all).Never throws — same rationale as the other helpers here.