I'd like to show my users if an error occurred while doing a proxy.proxy call.
While I know how to decode a system.ExtrinsicFailed
, as this is well documented, I have difficulties finding the correct way to decode an error from proxy.ProxyExecuted
when printed to string, it shows [{"err":{"module":{"index":4,"error":"0x02000000"}}}]
when there's an error or [{"ok": null}]
in case it succeeded.
What would be the best way to check the status and decode the error?
I am ideally looking at something similar than
const [dispatchError] = data
const decoded = api.registry.findMetaError((dispatchError as any).asModule);
const errorInfo = `${decoded.docs} - ${decoded.section}.${decoded.name}`;
But checking if dispatchError.err
exists or forcing it with asModule
doesn't end well, although it looks like a module. It needs a step in between to be decoded it seems, that I'm missing.
0x02000000
before encoding it as a number? e.g. use0x02
. The other zeroes are for extra error data.