InstructionError
s are a variant of TransactionError
, a core feature, nothing to do with web3.js specifically.
The first item in the tuple is the index (zero-based) of the instruction which raised the error.
The second item is the actual InstructionError
enum
variant. In your example Custom
which carries a u32
error code defined by the program which declared the corresponding instruction.
So the course of action here is to inspect the transaction to determine its third instruction. Use its program id to identify the project. Then hope that it is open source, has good docs or someone has reverse engineered the protocol already, so you can lookup the error.
You may be able to take a shortcut and instead infer what happened from the transaction logs if they exist and are informative