trident
trident copied to clipboard
More user friendly Anchor error codes
I came across multiple Anchor errors like
RPC response error -32002: Transaction simulation failed: Error processing Instruction 0: custom program error: 0xbc4
It would be more helpful instead of hex codes to get user friendly error output based on https://docs.rs/anchor-lang/latest/src/anchor_lang/error.rs.html#22
Hey @DXist!
Thank you for the report! We are not handling the anchor errors and it's not our priority to do so right now but if you want, you can take a look at it and create a PR :muscle:
If you have a problem like this, just convert the 0xbc4
to decimal number and try to find it in anchor docs: https://docs.rs/anchor-lang/latest/anchor_lang/error/enum.ErrorCode.html.
Your error is 3012
which should be this one: https://docs.rs/anchor-lang/latest/anchor_lang/error/enum.ErrorCode.html#variant.AccountNotInitialized
Yes, I've converted these codes manually. But it took me some time to understand that this error code comes from Anchor and to find the enum with codes.
If it's not possible to separate Anchor error codes from error codes of other programs then it would be good enough just to convert it to decimal value and provide the link to the enum documentation.
Can we introduce 'improvement' label for this issue to mark low priority status?