I noticed a strange behavior while defining custom error objects in Javascript:
function MyError(msg) { Error.call(this, msg); this.name = \"MyError\
What's wrong with doing it this way in ES6?
class MyError extends Error { constructor(message) { super(message); // Maintains proper stack trace (only on V8) if (Error.captureStackTrace) { Error.captureStackTrace(this, MyError); } this.appcode= 123; // can add custom props } }