Useful error messages with ExceptionMessages
When throwing a DOM exception, please ensure that you take the time to write an error message that helps developers understand what's gone wrong, and what they can do to fix things. Rather than simply calling es.throwDOMException(InvalidStateError), use the ExceptionMessages helper class to construct a more detailed and specific message. Perhaps:
ExceptionMessages::failedToExecute("nextNode", "NodeIterator", "The iterator is detached.");
That will give the user an exception object whose message property reads "Failed to execute "nextNode" on "NodeIterator": The iterator is detached.", which has been scientifically measured to be 83 times more useful than the default message for InvalidStateError: "An attempt was made to use an object that is not, or is no longer, usable.".
Developers will be much happier if we give them enough data to resolve an issue right away, so please don't be afraid of adding detail.
https://codereview.chromium.org/24199003/ is a recent example of the kinds of improvements we can make: just add #include "bindings/v8/ExceptionMessages.h" and go wild.