Extract a human-readable error from a failed dry-run result.
Handles every error shape found across the Polkadot contract ecosystem:
Revert reason (Ink SDK patched results / EVM contracts): { value: { revertReason: "InsufficientBalance" } }
{ value: { revertReason: "InsufficientBalance" } }
Nested dispatch errors (raw Ink SDK / pallet errors): { value: { type: "Module", value: { type: "Revive", value: { type: "StorageDepositNotEnoughFunds" } } } } Delegates to formatDispatchError for the Module.Pallet.Error chain.
{ value: { type: "Module", value: { type: "Revive", value: { type: "StorageDepositNotEnoughFunds" } } } }
ReviveApi runtime messages (eth_transact / ReviveApi.call): { value: { type: "Message", value: "Insufficient balance for gas * price + value" } }
eth_transact
ReviveApi.call
{ value: { type: "Message", value: "Insufficient balance for gas * price + value" } }
ReviveApi contract revert data: { value: { type: "Data", value: "0x08c379a0..." } }
{ value: { type: "Data", value: "0x08c379a0..." } }
Wrapped raw errors (patched SDK wrappers): { value: { raw: { type: "Message", value: "..." } } }
{ value: { raw: { type: "Message", value: "..." } } }
Generic error field: { error: { type: "ContractTrapped" } } or { error: { name: "..." } }
{ error: { type: "ContractTrapped" } }
{ error: { name: "..." } }
A dry-run result with at least success, and optionally value / error.
success
value
error
A human-readable error string, or "" if the result succeeded.
""
Extract a human-readable error from a failed dry-run result.
Handles every error shape found across the Polkadot contract ecosystem:
Revert reason (Ink SDK patched results / EVM contracts):
{ value: { revertReason: "InsufficientBalance" } }Nested dispatch errors (raw Ink SDK / pallet errors):
{ value: { type: "Module", value: { type: "Revive", value: { type: "StorageDepositNotEnoughFunds" } } } }Delegates to formatDispatchError for the Module.Pallet.Error chain.ReviveApi runtime messages (
eth_transact/ReviveApi.call):{ value: { type: "Message", value: "Insufficient balance for gas * price + value" } }ReviveApi contract revert data:
{ value: { type: "Data", value: "0x08c379a0..." } }Wrapped raw errors (patched SDK wrappers):
{ value: { raw: { type: "Message", value: "..." } } }Generic error field:
{ error: { type: "ContractTrapped" } }or{ error: { name: "..." } }