javascript - How to get more verbose logging in a Node application? -


i have node application defines modules starts express server. problem is, express server doesn't start , don't see errors.

when happens, scan git diff potential syntax errors , fix them. resolves problem, , server starts again.

the thing is, i'm not sure why these syntax errors failing silently.

i'll give example:

  module.exports = function(server){     this.register = function (params) {       return this.models.user.register(user)       } // syntax error - closing bracket     }     return   } 

when removed bracket, server started again, have thought i'd see syntax error raised instead of having blindly hunt bugs.

some more context: main.js file defines function returns promise. promise invoked running script directly (nodejs main.js).

a lot of code in app written promises. have effect of squelching errors? how can ensure errors logged regardless of scope occur in?

you can start logging unhandled promise rejections with:

process.on("unhandledrejection", (err) => {    console.error(err);  }); 

we added hook year ago. have plans make logging or throwing default behavior, apologize taking long.