Repository navigation
Attempting to console.log() DOMException.prototype throws error #60107
Description
Activity
In a browser, that logs
undefined, and it's a data property.In node,
Object.getOwnPropertyDescriptor(DOMException, 'prototype')also fails, and that should not even be possible.In a browser, that logs
undefined, and it's a data property.In node,
Object.getOwnPropertyDescriptor(DOMException, 'prototype')also fails, and that should not even be possible.how are you getting it to log
undefined?
here's firefox:

here's chrome:

In Node.js, I assume you're trying to run it in the REPL and the REPL is trying to print the object to the terminal using the same thing
console.log()uses (I assume it's usingutil.inspect()or whateverutil.inspect()is an abstraction for).Try
> void Object.getOwnPropertyDescriptor(DOMException, 'prototype').You're right, it's the inspection that's causing the problem, and it's failing on the first key
name.I now see that if i do
DOMException.prototype.nameorDOMException.prototypedirectly in the repl, it fails, and in Safari, it just logs undefined (i guess safari's console log implementation logs undefined when it throws). Chrome does something weird and different.What does the HTML spec say about this?
What does the HTML spec say about this?
WebIDL says that invoking a getter on an object that doesn't implement the appropriate interface throws a
TypeError. (The case of accessing it on theprototypeobject is directly called out elsewhere -- note thatDOMException::nameis not annotated withLegacyLenientThis). So that part seems correct.The Console standard is... frustratingly silent on error handling: it says nothing about how to handle errors during printing or formatting. (Which can occur if you try to
%sformat an object like{ toString() { throw new Error("nope") } }-- from a quick test: Firefox seems to silently discard the entireconsole.log()call in this case, Chrome propagates the exception).Reacted by Jordan HarbandReacted by charkaIn that case, it seems like node's well within its rights to do whatever it wants here, so while node may choose to do something different, it's not a bug as-is?
Node.js
console.log()implementation could throw for every every object passed in if it wanted, that doesn't make it good or useful behaviour.
It's not a bug in the context of the spec but I don't think the spec is a good context for deciding what's a bug in this case. I think it's a bug in the context of Node.js.Reacted by Yves M.- added a commit that references this issue
on Oct 20, 2025 - added a commit that references this issue
on Oct 23, 2025 - added 2 commits that reference this issue
on Feb 17, 2026
Version
v20.19.5, v22.19.0, v24.8.0
Platform
Subsystem
Console
What steps will reproduce the bug?
Evaluate
console.log(DOMException.prototype)in any way.How often does it reproduce? Is there a required condition?
Every time.
What is the expected behavior? Why is that the expected behavior?
Simply print the object to the terminal. That's what browsers do.
What do you see instead?
Additional information
No response