I am using this library to post messages to APNS (Apple push notification server). I can successfully post and get esponses but when there is an ECONNRESET error (probably due to idle connection), it is neither caught at http2req.on with the request nor in the callback for the response with a response.on('error'....
Code snippet below:-
callback = function (response) {
....
response.on('error', function (){console.log("GET request error")});
res.end();
});
var req = http2.request(options, callback);
req.write(http2Request.body);
req.end();
req.on('error', (e) => {
console.trace(e);
throw e;
});
I would like to catch the error so that I can handle the same without the node js client crashing.
I am using this library to post messages to APNS (Apple push notification server). I can successfully post and get esponses but when there is an ECONNRESET error (probably due to idle connection), it is neither caught at http2req.on with the request nor in the callback for the response with a response.on('error'.... Code snippet below:- callback = function (response) { .... response.on('error', function (){console.log("GET request error")}); res.end(); }); var req = http2.request(options, callback); req.write(http2Request.body); req.end(); req.on('error', (e) => { console.trace(e); throw e; });
I would like to catch the error so that I can handle the same without the node js client crashing.