François REMY (2013-07-10T16:39:45.000Z)
github at esdiscuss.org (2013-07-12T02:27:45.777Z)
In some browsers, using the native `Error` class enables cool features like automatic stack trace. Just in case you need special kind of `Error` (ie: subclasses), I recommend doing it that way: ```js function SomeError(message) { // the real instance should be an Error: var self = new Error(message); // but the prototype could be updated if(self.__proto__) { self.__proto__ = SomeError.protoype } else { copyProperties(SomeError.prototype, self); } // do some more custom things // ... // return the instance return self; } SomeError.prototype = Object.create(Error.prototype); throw new SomeError('abc'); ```