ember-ajax
ember-ajax copied to clipboard
How to use error handler helpers in glimmer version?
import { redirectToLogin } from 'new-frontend/utils/route-helpers';
import { UnauthorizedError } from 'ember-ajax/errors';
function commonErrorHandler(error) {
if (UnauthorizedError(error)) {
redirectToLogin.call(this);
}
}
export { commonErrorHandler };
I have this function in utility. Whenever I call the function commonErrorHandler
, I'm getting the following error.
https://github.com/ember-cli/ember-ajax/blob/5520bdf3561175f0a6b5827cd0c2d4b36dd2ef4f/addon/errors.ts#L19-L23
Those seem to be proper classes now, so you'd have to either instance check them or if you are creating one, use new. It seems like you are wanting to do an "instanceOf" but maybe i'm miss understanding.