-export default class BaseError extends Error {
+export class BaseError extends Error {
public constructor(message?: string) {
super(message);
this.name = new.target.name;
Object.setPrototypeOf(this, new.target.prototype);
- Error.captureStackTrace ? (Error.captureStackTrace(this, this.constructor)) : (this.createStack());
+ typeof Error.captureStackTrace === 'function'
+ ? Error.captureStackTrace(this, this.constructor)
+ : this.createStack();
}
private createStack(): void {