Node catch() error doesn't show file the error occured

266 Views Asked by At

I am using the new --inspect parameter in node to debug my application with Chrome Developer Tools. I have a very basic catch at the end of my promise chain but the errors returned are not showing clearly where they came from.

Am I able to see which file the error originated in?

  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

And directly from the console the error is:

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

There are 1 best solutions below

4
On

You might want to dump more information about the exception as in

console.log( err.stack );