请求失败;要求的参数

时间:2017-06-12 14:47:59

标签: javascript node.js riot-games-api

我在localhost上运行nodejs应用程序,一切顺利,直到我遇到此错误

Error: getLeaguePositions request FAILED; required params `id/summonerId/playerId` (int), `accountId/accId` (int), or `name` (string) not passed in
at updateLeague (C:\Users\Mikk\be\helpers\summonerProfile.js:104:27)

不确定我将如何处理此错误? 我对该方法的代码

function updateLeague(profile) {
  const { region } = profile;
  return leagueApi.League.positions({id: profile['summonerId'], region})
  .then((league) => {
    let leagueRanks = [];
    for (let entry of league) {
      let { queueType, tier, rank, leaguePoints } = entry;
      leagueRanks.push({
        queueType,
        tier,
        division: rank,
        leaguePoints
      });
    }
    profile['leagueRanks'] = leagueRanks;
    return profile;
  }).catch((err) => {
    if (err.message == 'Error getting league data: 404 Not Found') {
      return profile;
    }
    else {
      handleErr(err);
    }
  });
}

0 个答案:

没有答案