node-modbus-serial
node-modbus-serial copied to clipboard
Modbus/TCP: If the connection is broken, an unhandled promise rejection error is generated, and it can't be caught
If I disconnect the modbus/tcp device from the network, to test what happens, I am getting the following error:
(node:25171) UnhandledPromiseRejectionWarning: Error: TCP Connection Timed Out
at Socket.--unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2041679)
This error seems to be un-catchable within my code, no matter where I add a try/catch block or promise .catch() statement, this error is still thrown.
Expected behavior: I should be able to catch and handle this error to avoid the unhandled promise rejection warning.
hello, thank you for the issue !
can you make a pull request fixing that ?
Working on it...
From what I can tell, it appears this is a bug in request-promise-native (see https://github.com/request/request-promise-native/issues/31)
I face the same issue. Would be great if this could be resolved.