'use strict';
class CustomError extends Error {
constructor(...args) {
super(...args);
Object.defineProperty(this, 'name', { value: this.constructor.name });
Error.captureStackTrace(this, this.constructor);
}
}
class ExtendedError extends CustomError {
constructor(...args) {
super(...args);
}
}
try {
throw new ExtendedError('gnarf')
} catch(err) {
console.log(err.name);
console.log(err);
}
module.exports = CustomError;