How to get ERROR message from flow emulator?

I was using this piece of code to determine when the transaction is completed on the frontend.
Selection_017

After the transaction is completed I’m getting this
Selection_016

However, the execution failed because of the difference in types

Is there any way to read these errors directly ?

1 Like

tagging @qvvg

Morning @jayesh_wayesh,

The txStatus has a couple things in it. Including an a statusCode (which if its non-zero means something went wrong) and an errorMessage (which sounds closer to what you are looking for). We get these values directly from the Access Node. Frustratingly this might not even be what you are looking for, but we definitely feel your pain, and are actively working on making this better. In the mean time statusCode and errorMessage are probably the way to go.

2 Likes

Thanks, @qvvg :raised_hands:
I can totally work with that!

@jayesh_wayesh also be aware that I am currently working on making the fcl.tx(resp).once* family of functions throw an error if they receive a non-zero status code. https://github.com/onflow/flow-js-sdk/issues/297

To keep things backwards compatible this will probably be enabled via a flag. Feel free to leave any comments or concerns in the issue, we will definitely see them.

2 Likes

Sure @qvvg . :raised_hands: