Description
To allow better interoperability with ES6 classes (which are forced to call the super() constructor) it is better to add the following condition to the HttpError constructor:
if (this.constructor === HttpError) {
throw new TypeError('cannot construct abstract class')
}
This way the class can be extended with a concrete class like this:
class MyHttpError extends HttpError {
constructor() {
super();
...
}
}
A variant using ES6 classes as base class is shown here but the same works with old school constructor functions as well.
Metadata
Metadata
Assignees
Labels
No labels