Skip to content

Commit

Permalink
fix: catch error thrown in getMultipleInputRegisters (#576)
Browse files Browse the repository at this point in the history
* fix(servertcp_handler): uncaught getMultipleInputRegisters errors

* fix: linting error

* fix: second linting error
  • Loading branch information
danieljpwtg authored Feb 5, 2025
1 parent 70e12d2 commit cba73fe
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion servers/servertcp_handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,15 @@ function _handleReadInputRegisters(requestBuffer, vector, unitID, callback) {
}
});
} else {
const values = vector.getMultipleInputRegisters(address, length, unitID);
let values;

try {
values = vector.getMultipleInputRegisters(address, length, unitID);
} catch (error) {
callback(error);
return;
}

if (values.length === length) {
for (var i = 0; i < length; i++) {
tryAndHandlePromiseOrValues(i, values);
Expand Down

0 comments on commit cba73fe

Please sign in to comment.