Whether a value is a genuine Error — a same-realm instance, or an object
whose [[Class]] brand reports Error (which a cross-realm Error does
regardless of its foreign prototype chain).
Deliberately NARROWER than isErrorLike: the duck-typed
name+message+stack triple does not qualify. The console interceptor's
stack-precedence pass depends on exactly this distinction — a context bag
that happens to carry the full triple must not outrank a real Error's stack.
instanceof Error comes first because the brand check can miss real Errors:
a Firefox DOMException is instanceof Error (WebIDL) but tags as
[object DOMException].
Never throws — instanceof walks [[GetPrototypeOf]] and the brand check's
Symbol.toStringTag lookup does a [[Get]], both of which throw for a revoked
Proxy, and this runs inside the patched console methods.
Whether a value is a genuine
Error— a same-realm instance, or an object whose[[Class]]brand reportsError(which a cross-realm Error does regardless of its foreign prototype chain).Deliberately NARROWER than isErrorLike: the duck-typed
name+message+stacktriple does not qualify. The console interceptor's stack-precedence pass depends on exactly this distinction — a context bag that happens to carry the full triple must not outrank a real Error's stack.instanceof Errorcomes first because the brand check can miss real Errors: a FirefoxDOMExceptionisinstanceof Error(WebIDL) but tags as[object DOMException].Never throws —
instanceofwalks [[GetPrototypeOf]] and the brand check's Symbol.toStringTag lookup does a [[Get]], both of which throw for a revoked Proxy, and this runs inside the patched console methods.