```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


_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to