Closed dmrathore closed 6 years ago
Master.read/write/execute()
functions return an instance of Transaction
which extends Node's EventEmitter
. If an object emits an error
event and there aren't any listeners registered, an exception will be thrown:
const {EventEmitter} = require('events');
const ee = new EventEmitter();
console.log('hello');
ee.emit('error', new Error());
console.log('bye');
You must attach error
event handler to each Transaction
:
const t = master.readHoldingRegisters(0x0000, 1);
t.on('error', err => console.error(err.message));
or set the master's suppressTransactionErrors
option to true
(a noop function will be registered automatically for each created Transaction
):
const master = modbus.createMaster({
suppressTransactionErrors: true
});
hello, I am using the your package for my project and its working fine but recently i got this error-
events.js:141 throw er; // Unhandled 'error' event ^ ResponseTimeoutError: No response was received from the slave in the specified time. at Transaction.handleTimeout (/media/rathore/mydata/project/inspinia_test/.meteor/local/isopacks/jeremybyu_mmodbus/npm/node_modules1/h5.modbus/lib/Transaction.js:452:20) at Timer.listOnTimeout (timers.js:92:15)
Can you help me with this error.
Thanks