Search code examples
node-redhyperledger-composer

Node-Red - Catching Error - node-red-contrib-composer


I am using composer nodes in nod-red flow node-red-contrib-composer

There are cases when node is throwing error

"Error trying invoke business network. Error: Peer has rejected transaction 'ce59c38741626ca5dbc1ae7055e0a52297ff99293751f796ed41d40b5cfc59e9' with code MVCC_READ_CONFLICT "

I can see this error in debug console but I cannot catch this error using catch node available in node-red. I think, in composer nodes, below code is used:

    .catch((error) => {
                        node.error(error.message);
     });

How can I catch this error in node-red? I would like to use this error message in order to trigger another flow in same tab.


Solution

  • Putting aside the specific details of the error, the reason you cannot handle this error with a Catch node is due to how the composer node is reporting the error.

    It is calling node.error with a single argument, which means it is logged and no further action taken.

    In order to trigger a Catch node, the call to node.error must provide a second argument which is the message object the Catch node should send.

    I suggest you raise an issue against the composer nodes to get this change made.