megastef / node-crate

Node.js base DB-Driver for CRATE (www.crate.io)
52 stars 18 forks source link

catch 'error' event on request in case of ECONNREFUSED #25

Closed gertvdw closed 6 years ago

gertvdw commented 6 years ago

Hi,

When used with node-red-contrib-crate, node-red crashes when the database is unavailable. The cause is an unexpected socket hangup because error events on the request are not handled. This commit rejects the promise, and calls 'req.end()' to prevent an unexpected socket hangup.

Regards,

Gert