Node.js SequelizeJS-为什么我的实例重新加载失败,并带有;TypeError:无法读取属性';数据值';“无效”的定义;

Node.js SequelizeJS-为什么我的实例重新加载失败,并带有;TypeError:无法读取属性';数据值';“无效”的定义;,node.js,sequelize.js,Node.js,Sequelize.js,我使用Sequelize模型将登录用户的信息存储在一个节点webapp中。user模型是paranoid(),如果用户停用其帐户,实例将被删除。当我尝试重新加载一个停用的用户实例时,它会失败,并出现以下类型的错误。为什么? TypeError: Cannot read property 'dataValues' of null at null.<anonymous> (/home/christo/repos/ticktrack/login-fiddle/src/server/

我使用Sequelize模型将登录用户的信息存储在一个节点webapp中。
user
模型是paranoid(),如果用户停用其帐户,实例将被删除。当我尝试重新加载一个停用的用户实例时,它会失败,并出现以下类型的错误。为什么?

TypeError: Cannot read property 'dataValues' of null
    at null.<anonymous> (/home/christo/repos/ticktrack/login-fiddle/src/server/node_modules/sequelize/lib/instance.js:723:20)
    at tryCatcher (/home/christo/repos/ticktrack/login-fiddle/src/server/node_modules/sequelize/node_modules/bluebird/js/main/util.js:24:31)
    at Promise._settlePromiseFromHandler (/home/christo/repos/ticktrack/login-fiddle/src/server/node_modules/sequelize/node_modules/bluebird/js/main/promise.js:489:31)
    ...

将重载函数绑定到
this,{paranoid:false}
修复了该问题

发生TypeError是因为正在重新加载的实例已被软删除。当调用
reload
时没有任何选项(绑定中的
undefined
),内部调用
reload
find
没有找到任何实例并返回null。这反过来导致错误消息
TypeError:cannotreadproperty'dataValues'为null

更新后的功能代码:

    increment_unsuccessful_logins: function increment_unsuccessful_logins() {
      return this.increment({ unsuccessful_logins: 1})
        .then(this.reload.bind(this, { paranoid: false }));
    },

将重载函数绑定到
this,{paranoid:false}
修复了该问题

发生TypeError是因为正在重新加载的实例已被软删除。当调用
reload
时没有任何选项(绑定中的
undefined
),内部调用
reload
find
没有找到任何实例并返回null。这反过来导致错误消息
TypeError:cannotreadproperty'dataValues'为null

更新后的功能代码:

    increment_unsuccessful_logins: function increment_unsuccessful_logins() {
      return this.increment({ unsuccessful_logins: 1})
        .then(this.reload.bind(this, { paranoid: false }));
    },