0

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.

2 Answers2

1

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.

knolleary
  • 9,777
  • 2
  • 28
  • 35
  • Thank you. How can I do this change locally if possible? If you can suggest me the changes then I will try change and test my node-red. – Akshay Jindal Mar 23 '18 at 17:16
  • As a minimum, you could try changing the `node.error()` call you have shared to be node.error(error.message,{}); - although out of context, I can't say if that makes sense for where that error is being thrown. – knolleary Mar 23 '18 at 17:26
0

as mentioned on Rocketchat - the error comes from Fabric - might want to have a watcher that finds the error in the logs (and pulls it into your flow ? ie for the transaction id that failed) See also here on info about avoiding collisions -> MVCC_READ_CONFLICT when submitting multiple transactions concurrently

An error like MVCC_READ_CONFLICT can't currently be captured (ie the time of writing) by debug node in the node-red flow (only avl in the debug console). Not unless node.error(msg) or similar was available in the composer node-red mpdule (eg. node.error("Error",msg)) - so that a catch node in node-red may be used to capture that error and go about re-sbumitting a transaction subject to an earlier 'MVCC_READ_CONFLICT'.

Paul O'Mahony
  • 6,740
  • 1
  • 10
  • 15