Correct way to catch tx errors #439
-
I am currently experiencing an issue with handling transaction errors in your library. Specifically, I'm unable to catch errors for transactions. await author.submitAndWatchExtrinsic(srExtrinsic,
(data) => log.d('From here: ${data.type} - ${data.value}')); The problem is that data always indicates a successful blockchain submission, even when the extrinsic fails. Is there a recommended way to catch and handle these transaction errors using your library? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The extrinsic failing is not an error. The extrinsic was submitted, accepted, and included in a block. |
Beta Was this translation helpful? Give feedback.
The extrinsic failing is not an error. The extrinsic was submitted, accepted, and included in a block.
There was no error in there. What you need to do if you want to do something when an extrinsic fails is to
watch
the extrinsic with the command above and check the extrinsicresult
. If the result isEXTRINSIC_FAILED
, then do whatever you want.