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

Reload doesn't check if the reloaded instance is defined #4452

Closed
glutentag opened this Issue Sep 8, 2015 · 2 comments

Comments

2 participants
@glutentag

glutentag commented Sep 8, 2015

Hello,

When we reload an instance, it doesn't check if the returned object is defined:

 return this.Model.findOne(options).bind(this).then(function(reload) {
    this.set(reload.dataValues, {
      raw: true,
      reset: true && !options.attributes
    });
  }).return(this);

Returning us a TypeError:
Cannot read property 'dataValues' of null

It would be nice to have an error to catch there. Should it be a native Error or a SequelizeErrors?

@mickhansen mickhansen added the bug label Sep 8, 2015

@mickhansen

This comment has been minimized.

Contributor

mickhansen commented Sep 8, 2015

I suppose this would happen in cases where the object you're attempting to reload has been deleted in the meantime?

@glutentag

This comment has been minimized.

glutentag commented Sep 8, 2015

Exactly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment