Sign in to follow this  
SegFault

NodeJS error handling

Recommended Posts

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 ?

Share this post


Link to post
Share on other sites
Posted (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 by biostunt

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.