triAGENS/ArangoDB — pull request #731 by pluma (2014-01-11 20:43:13+00:00)
Title: Added support for error names instead of error types

In JavaScript, `Error` is not a real constructor. Regular constructors directly modify `this`, whereas `Error` always returns a new object. This makes it [a bit tricky](https://github.com/Ralt/newError) to create "real" Error sub-types.

Because of this a lot of libraries allow distinguishing errors by their `name` (which is also used by `Error` in stacktraces) instead of `instanceof`.

I think `errorResponse` would be more useful if it also allowed catching errors by their name. This change would be backwards-compatible with the `instanceof` check because `instanceof` always expects a constructor.