export class StandardError extends Error { [key: string]: any; has = Object.hasOwnProperty; proto = Object.getPrototypeOf; constructor(props: any) { super(); // Let all properties be enumerable for easier serialization. this.message = props if (props && typeof props === 'object') { props = props; this.message = ''; } // Name has to be an own property (or on the prototype a single step up) for // the stack to be printed with the correct name. if (props) for (let key in props) this[key] = props[key]; //if (!this.has.call(this, "name")) // this.name = this.has.call(this.proto(this), "name")? this.name : this.constructor.name; } }