获得警告:使用Turbo的非错误:[object String]拒绝承诺

时间:2017-11-01 16:23:34

标签: javascript reactjs promise redux bluebird

注意:Turbo使用react / redux

我正在使用Turbo,你可以在这里找到更多关于https://www.turbo360.co/

的信息

我得到的Warning: a promise was rejected with a non-error: [object String]大约一个星期我没有参与这个项目,我当时没有警告。我今天打开它,突然间我做了。

我不直接使用蓝鸟,我使用turbo库来回复我的行为。在我的所有承诺中,如果我没有使用then块中的数据,那么我会执行return null,如果我正在使用数据,那么它只是alert之类的Sucess {1}}。在catch块中,我只是console.log(err)alert(err)

当应用程序加载时会发生这种情况,因此我会发布应用程序加载时调用的promises只是为了澄清

    if (this.props.post.all == null) {
      this.props
        .fetchPosts({})
        .then(response => {
          return null;
        })
        .catch(err => {
          console.log(err);
        });
    }
    if (this.props.reply.all == null) {
      this.props
        .getReplies({})
        .then(() => {
          return null;
        })
        .catch(err => {
          console.log(err);
        });
    }

  if (this.props.user.currentUser == null) {
      this.props
        .currentUser()
        .then(data => {
          return null;
        })
        .catch(err => {
          console.log(err);
        });
    }

这些是应用程序加载时使用的三个承诺。

1 个答案:

答案 0 :(得分:0)

您是否尝试删除返回空值?

相关问题