节点catch()错误未显示错误发生的文件

时间:2017-07-15 22:35:01

标签: javascript node.js error-handling node-inspector node-debugger

我在节点中使用new --inspect参数来使用Chrome Developer Tools调试我的应用程序。我的保证链末尾有一个非常基本的catch但是返回的错误并没有清楚地显示它们来自哪里。

我能看到错误源自哪个文件吗?

  leagues(app).getLeagues(passData)
    .then(teamsApi.getNorsemenTeams)
      .then(filterBarGamesIndex)
    .then(gamesApi.getNorseGames)
    .then(gamesApi.getFilteredTeams)
    .then(function (passData) {
      res.render('games', {
        title: 'Results',
        passData: passData,
        type: req.originalUrl.split('/')[2]
      })
    })
      .catch(function(err) {
          console.error(err); //Line 35
      });
}

enter image description here

直接从控制台出错:

TypeError: Cannot read property 'Intermediate_Division_2' of undefined
    at /var/www/beta.norsemanfc.co.uk/app/controllers/filterBar/fixturesIndex.js:27:62
    at Array.filter (native)
    at module.exports (/var/www/beta.norsemanfc.co.uk/app/controllers/filterBar/fixturesIndex.js:25:42)
    at process._tickCallback (internal/process/next_tick.js:103:7)

1 个答案:

答案 0 :(得分:3)

您可能希望转储有关该异常的更多信息,如

console.log(err.stack);