João Eiras:
DOMExceptions have both a code and a message. Perhaps the constructor should be extended to include both.
Anne van Kesteren:
code is legacy, but name would be good to expose.
The constructor has the same signature as the standard ECMAScript Error constructors, so we are being consistent there. I think it's fine for code and name to be assigned after creating the object, if JS needs to create a DOMException object (which I don't expect to be a common thing anyway).