【发布时间】:2017-07-16 07:01:50
【问题描述】:
我在节点中使用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
});
}
直接从控制台错误是:
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)
【问题讨论】:
-
根据错误,您的错误似乎发生在
filterBarGamesIndex -
我同意,但我的系统中不存在这样的文件:/
-
你用的是什么浏览器?如果您使用的是 Firefox,您可以尝试
console.log(err.lineNumber),如 Mozilla page 所述。 -
@brennanenanen 这是 Node.js。
-
@PatrickRoberts 你是对的,奇怪的是我在搜索
fixturesIndex,我在phpstorm中使我的缓存无效,然后它找到了文件。
标签: javascript node.js error-handling node-inspector node-debugger