domenic at domenicdenicola.com (2013-07-13T00:57:47.945Z)
> At best, this will not preserve the stack trace property, at worse this will lead to a bad one.
Because the location info will be that of the `new Error`? One could
try this instead, which seems to work for me:
```js
throw { __proto__ : new Error(), reason: "Monday" }
```
>> ```javascript >> function CustomError(message) { >> this.message = message || ''; >> } >> CustomError.prototype = new Error; >> >> // whenever you need >> throw new CustomError; >> ``` > > At best, this will not preserve the stack trace property, at worse this will lead to a bad one. Because the location info will be that of the "new Error"? One could try this instead, which seems to work for me: throw { __proto__ : new Error(), reason: "Monday" } Claus