molnarg / node-http2

An HTTP/2 client and server implementation for node.js
MIT License
1.79k stars 185 forks source link

Forward endpoint errors to httpsRequest #185

Open felicienfrancois opened 8 years ago

felicienfrancois commented 8 years ago

Needed to be able to handles thoose errors gracefully because endpoint is not exposed.

nwgh commented 8 years ago

Hrm, so for these, I think I would rather see some logging happen, as well, similar to how we do other errors that we forward on through other objects:

var self = this;
whatever.on('error', function (error) {
  self._log.error('Whatever error: ' + e.toString());
  forwardObject.emit('error', error);
}

Where whatever is the object you're catching errors from, and forwardObject is whatever you're calling emit on in your forwarder (sometimes self, sometimes httpsRequest in your patch).

That way we have symmetry in how we handle errors.

felicienfrancois commented 8 years ago

@nwgh Ok, I just comitted the fix

felicienfrancois commented 8 years ago

just a friendly bump :)