节点catch()错误不显示文件错误发生
我在节点中使用new
--inspect
参数来使用Chrome Developer Tools
来debugging我的应用程序。 在我的承诺链的最后,我有一个非常基本的问题,但是返回的错误没有清楚地显示它们来自哪里。
我能看到错误发生在哪个文件?
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.stack);