Posts

Showing posts from August, 2015

Node JS - Error Handling

Image
//English Hi Guys, today I want to talk about the Error Handling on NodeJS, so far there's no way to handle the errors properly on Node. There are certain techniques, I'm going to touch on a couple of them in this post, but these techniques are unstable for now. But they still work, maybe in future releases Joyent will change these specifications or at least some of them. <!-- Bad way or the way we used to do it... --> Usually we catch the error on the process of our application, we do something like this: 1 2 3 process . on ( 'uncaughtException' , function ( err ){ //Let's handle the error... }) But, what are we doing wrong? We are following what Joyent says, If something unexpected happens, we should catch it and handle the error properly...The problem here is that we are catching the error at the process level, so if you have some async process running in background and one of them throws an error, it will break the entire applicati...