The stack from an unknown thrown value, or undefined when there isn't one.
The duck-typed branch is deliberate: some Firefox DOMExceptions carry a
stack without being reported as an Error, and a thrown plain object may
carry one too.
Never throws. stack can be a throwing accessor and 'stack' in x can hit
a throwing Proxy trap — and this runs inside the patched console.warn /
console.error BEFORE the original console call, so a throw here would
swallow the very diagnostic being logged and break the calling code.
The stack from an unknown thrown value, or
undefinedwhen there isn't one.The duck-typed branch is deliberate: some Firefox
DOMExceptions carry astackwithout being reported as anError, and a thrown plain object may carry one too.Never throws.
stackcan be a throwing accessor and'stack' in xcan hit a throwing Proxy trap — and this runs inside the patchedconsole.warn/console.errorBEFORE the original console call, so a throw here would swallow the very diagnostic being logged and break the calling code.