Polkadot Apps
    Preparing search index...

    Function formatDispatchError

    • Extract a human-readable error from a transaction result's dispatch error.

      PAPI dispatch errors for pallet modules are nested: { type: "Module", value: { type: "Revive", value: { type: "ContractReverted" } } }

      This walks the chain to build a string like "Revive.ContractReverted".

      Parameters

      • result: { dispatchError?: unknown; ok: boolean }

        A transaction result with ok and optional dispatchError.

      Returns string

      A human-readable error string, or "" if the result is ok, or "unknown error" if the dispatch error cannot be decoded.