davepacheco/node-verror — pull request #6 by trentm (2012-10-17 16:18:13+00:00)
Title: VError and WError toString() use the ctor name, fallback to prototype.name

With a scenario like this:

function ConnectionClosedError() {
WError.call(this, 'connection closed; request aborted');
}
util.inherits(ConnectionClosedError, WError);

recent changes made it so the toString() would use 'WError' as the
error name instead of 'ConnectionClosedError'. One needed to also
do:

ConnectionClosedError.prototype.name = 'ConnectionClosedError';

Drop the need for that boilerplate.

Note: I've made the `this.constructor.name` win here over `this.constructor.prototype.name`. Ideally I'd have had it the other way around, but that isn't possible because then you'd still need the boilerplate above as the `WError.prototype.name = 'WError'` would "win".