解析云代码错误141未调用成功/错误

时间:2015-12-12 01:48:55

标签: asynchronous parse-platform cloud-code

当执行以下代码时,我得到“错误:141未成功/错误被调用”,但如果从用户的回答历史中正确检索到“回合”,我显然会返回成功。

Parse.Cloud.define("analyzeRound", function(request, response) {

  var x = [];
  var user = request.user;

  user.get("answerHistory").get("round", {
    success: function(educationRound) {
      for (var i = 0; i < educationRound.length; i++) {
        x.push(0);
      }
      response.success("success");
    },
    error: function(error) {
      response.error("failed");
    }
  });
});

非常感谢任何帮助!

1 个答案:

答案 0 :(得分:0)

这最终给了我正在寻找的东西,谢谢Mo Nazemi!

Parse.Cloud.define("analyzeRound", function(request, response) {

  var x = [];
  var user = request.user;

  var answerHistory = user.get("answerHistory");
  answerHistory.fetch({
    success: function(answerHistory) {
      var round = answerHistory.get("round");
      for (var i = 0; i < round.length; i++) {
        x.push(0);
      }
      response.success("success");
    },
    error: function(error) {
      response.error("failed");
    }
  });
});