Skip to content

Commit

Permalink
fix then/catch sequence
Browse files Browse the repository at this point in the history
  • Loading branch information
erossignon authored and sterfive committed Nov 3, 2023
1 parent eac74c3 commit a66305a
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions packages/node-opcua-client-crawler/source/node_crawler_base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -505,11 +505,8 @@ export class NodeCrawlerBase extends EventEmitter implements NodeCrawlerEvents {

this.session
.read(nodesToRead)
.catch((err: Error) => {
return callback(err);
})
.then((dataValues) => {
for (const [readTask, dataValue] of zip(selectedPendingReadTasks, dataValues!)) {
for (const [readTask, dataValue] of zip(selectedPendingReadTasks, dataValues)) {
assert(Object.prototype.hasOwnProperty.call(dataValue, "statusCode"));
if (dataValue.statusCode.equals(StatusCodes.Good)) {
/* istanbul ignore else */
Expand All @@ -523,6 +520,9 @@ export class NodeCrawlerBase extends EventEmitter implements NodeCrawlerEvents {
}
}
callback();
})
.catch((err: Error) => {
callback(err);
});
}

Expand Down Expand Up @@ -836,11 +836,11 @@ export class NodeCrawlerBase extends EventEmitter implements NodeCrawlerEvents {
callback(
new Error(
"Error " +
dataValue.statusCode.toString() +
" while reading " +
nodeId.toString() +
" attributeIds " +
AttributeIds[attributeId]
dataValue.statusCode.toString() +
" while reading " +
nodeId.toString() +
" attributeIds " +
AttributeIds[attributeId]
)
);
}
Expand Down

0 comments on commit a66305a

Please sign in to comment.