How can I filter socket hang up errors?
Created by: JSteunou
I'm using node-http-proxy for a while now, and I think I'm using it quite right catching errors like this
proxy.on('error', function(err, req, res) {
// log
// ...
// handle
if (!res.headersSent) {
res.writeHead(500, { 'content-type': 'application/json' });
}
res.end(JSON.stringify({ error: 'proxy_error', reason: err.message }));
});
But I can have two cases that make a "socket hang up" error happen.
- Crash behind
- Client cancelling the request
Watching at my log I can make no differences between those two cases and it's quite frustrating. Before knowing about request abort (thank #527 (closed)) I really though I have an error going on.
So, what's the best practice to filter the request.abort case out?