节点catch()错误没有显示错误发生的文件
我正在使用节点中的new
--inspect
参数来调试我的应用程序Chrome Developer Tools
。我在承诺链的末尾有一个非常基本的catch
,但返回的错误没有清楚地显示它们来自哪里。节点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)
您可能要抛售有关异常的详细信息,如
的console.log(ERR。堆栈);
这会导致非常类似的错误令人遗憾'TypeError:无法读取属性'Intermediate_Division_2'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)' –
由于'filterBar/fix turesIndex.js'根本不是真正的文件。我相信这可能与我使用'jade'作为我的模板有关? –
这不是“非常相似”。你在那里有更多的地点。 –
根据错误,它出现错误发生在'filterBarGamesIndex' –
我同意,但是我的系统中不存在这样的文件:/ –
您使用的浏览器是什么?如果您使用的是Firefox,您可以在[Mozilla页面]上试用'console.log(err.lineNumber)'(https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Error )。 – brennanenanen