I am using the library request to post data but I constantly get the error ECONNRESET even though I have an error event handler for it. Sometimes my code does indeed handle the error, but not everytime.
I have this in a loop:
request.post(url, {form:{data}}).on('error',
function(err){
if(err === 'ECONNRESET'){
console.log('ECONNRESET')
}
})
And, as described, I still get this error:
throw er; // Unhandled 'error' event
^ Error: read ECONNRESET
Seems like .on('error', ...);
can't catch ECONNRESET after N times so the only way to solve if (afaik now) is using process.on('uncaughtException', function(error) {})
I hope this help other people :)