1

I'd like to know if there is a dedicated function or if someone knows where to find a good portion of code (nodejs) in order to get details about a tx error code ? I found out that the error description is stored in the metadata of the chain, and we can get it with api.rpc.state.getMetadata(), but its content is somehow obscure for me

eg If I sign a tx in Khala parachain, which fail, I get this :

system.ExtrinsicFailed [{"module":{"index":88,"error":"0x0e000000"}},{"weight":195000000,"class":"Normal","paysFee":"Yes"}]

which I can convert to error index:88 module:14 (0e in hex to dec) but then I don't know how to lookup the error within the metadata

thanks!

1 Answer 1

2

Let's take Polkadot as an example.

If the error is module: 5 error: 0.

Then it is the 5th module(starting from 0, you know that programmer counts starting from 0) of the runtime.

And the 0th error of the pallet-balances.


If they didn't specify the index in construct_runtime! then the list order is the index.

1
  • Ok, thanks I understand better the error code itself, but do I have to parse the metadata myself ? the best way I found to do it is to render the metadata as a JSON and parse it, to lookup the error index, then get an error "type" (which is a number) and lookup again this number and find another object, then get the error 14 (converted from the first two digits of the hex error code), and find there the error description. Is there is no function to do this easier ?
    – Arno
    Commented Oct 12, 2022 at 21:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.