-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Class constructor EmberError cannot be invoked without 'new' #5752
Comments
I have a fix at https://github.com/ssutar/data/blob/v_3_5_beta/addon/-private/adapters/errors.js#L79 but its not same as the current code. Its something like this:
Its creating a new property cc: @rwjblue @krisselden |
This depends on usage, but I think this is meant to be a class, and if so the accurate update would be: export class AdapterError extends EmberError {
constructor(errors, message = 'Adapter operation failed') {
super(message);
this.isAdapterError = true;
this.errors = errors || [
{
title: 'Adapter Error',
detail: message,
},
];
}
} |
Yeap, but would that need |
Because this is a class which does not extend from |
@pzuraq I read through the conversation about making |
@runspired EmberError already extends from native Error, sort of. The fix in Ember would be to get rid of EmberError entirely, and just export native Error in its place: If we went this direction it would make more sense to remove AdapterError entirely, and instead rely on error codes or messages |
Agree with @pzuraq, error subclasses are hard :( |
We resolved this by reverting the change from function to class based definition of |
When used with
ember-native-class-polyfill
for ES6 classes, following error is thrown:It is originated from https://github.com/emberjs/data/blob/master/addon/-private/adapters/errors.js#L79
As
EmberError
is a class withember-native-class-polyfill
, it cannot be called withoutnew
.The text was updated successfully, but these errors were encountered: