Custom Errlr
by Artem
JavaScript
'use strict';
class PropertyError extends Error {
constructor(property) {
super(property);
this.name = this.constructor.name;
this.message = 'API Error ' + property;
if (Error.captureStackTrace) {
Error.captureStackTrace(this, this.constructor);
} else {
this.stack = (new Error()).stack;
}
}
}
var e = new PropertyError('Hello');
console.dir(e);