jimmywarting / wemo-client

JavaScript client library for controlling and subscribing to Wemo Devices
MIT License
132 stars 40 forks source link

Fix error handler on http.request error #19

Closed devbobo closed 8 years ago

devbobo commented 8 years ago

I'm using @rudders Wemo platform for Homebridge, and my server kept crashing with the following error on my WeMo NetCam device:

events.js:85
      throw er; // Unhandled 'error' event
            ^
Error: connect EHOSTUNREACH
    at exports._errnoException (util.js:746:11)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1010:19)

I found that the error event handler added within the callback was not being called, adding the additional callback directly on the http.request object resolves this issue. I'm not sure if you still need the one inside the callback...but it should be easy enough to test.

timonreinhard commented 8 years ago

Good finding, thanks!

rudders commented 8 years ago

Sweet. Thanks Timon.

rudders commented 8 years ago

Will you push this as a release Timon or have you other changes in the wind?

timonreinhard commented 8 years ago

Sure, I tend to release early and often.

rudders commented 8 years ago

I've set a dependency on my fork of your latest for now so no hurry.