huejay
huejay copied to clipboard
Error handling
So there is something wrong with the error handling; I see the following in my NodeRed log which uses Huemagic, which uses Huejay, and it crashes NodeRed completely with the following message;
This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason: May 31 05:02:12 nodered Node-RED[10718]: Error: Huejay: connect ENETUNREACH 192.168.1.55:80 - Local (0.0.0.0:0)
I have tried looking at how Huejay does error handling but with my limited nodejs knowledge I could not make anything out of it. To me it looks like a lot of nesting is done with catch blocks and promises, it looks like there goes something wrong. I don't think it should crash on a connection error.