SegFault Posted July 16, 2019 Share Posted July 16, 2019 Hello, It seems that actually every errors like undefined variables are not throwing any errors and simply avoid the next code execution, After finishing a big module it's very annoying to debug line by line with console.logs when you can have a working debugger.. ahah I'm not able to catch any errors using the process error EventEmitter, Do someone have a solution to enable error throwing / debugging ? Link to comment Share on other sites More sharing options...
biostunt Posted July 17, 2019 Share Posted July 17, 2019 (edited) Try to use assert in your code. For example: let tmp = 1; let untmp; console.assert(untmp != undefined, "assertion falied."); // console : assertion failed. console.assert(tmp != undefined, "assertion failed"); // console : nothing Edited July 17, 2019 by biostunt Link to comment Share on other sites More sharing options...
SegFault Posted December 10, 2019 Author Share Posted December 10, 2019 My issue was an error event that wasn't triggered,in a called subfunction. I solved it by using a try catch index.js const module = require("app"); try { module(); } catch (e) { throw e; process.exit(); } app.js function Func() { klfhqirhgojgre() // this is undefined } module.exports = Func; Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now