I am trying to extend Error with ES6 and Babel. It isn\'t working out.
class MyError extends Error { constructor(m) { super(m); } } var error = new
I am trying to extend Error with ES6
That class MyError extends Error {…} syntax is correct.
class MyError extends Error {…}
Notice that transpilers still do have problems with inheriting from builtin objects. In your case,
var err = super(m); Object.assign(this, err);
seems to fix the problem.