What's wrong with:

```javascript

throw new CustomError('message')

function CustomError(message /* accept any custom arguments here */) {
  Error.call(this, message)
  this.name = 'CustomError'
  /**
   * add any custom error info here
   */
}
CustomError.prototype = Object.create(Error)
CustomError.prototype.constructor = CustomError
```

In ES6 land this becomes:


```javascript

throw new CustomError('message')

class CustomError extends Error {
  constructor (message /* accept any custom arguments here */) {
    super(message) 
    this.name = 'CustomError'

    /**
     * add any custom error info here
     */
  }
}
```

Doesn't that seem like an obvious enough solution?
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to