Answer the question
In order to leave comments, you need to log in
How can this code be rewritten in ES6?
function AuthError(message) {
Error.apply(this, arguments);
Error.captureStackTrace(this, AuthError);
this.message = message;
}
util.inherits(AuthError, Error);
AuthError.prototype.name = 'AuthError';
exports.AuthError = AuthError;
Answer the question
In order to leave comments, you need to log in
export class AuthError extends Error {
constructor(message) {
super(...arguments);
Error.captureStackTrace(this, AuthError);
this.message = message;
}
get name() {
return 'AuthError';
}
}
Weird code in some places... and not all of it.
But most likely like this:
import { Error } from "path/to/class/Error"
class AuthError extends Error {
...
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question