ReportedContractError

public struct ReportedContractError : Equatable, Hashable, Sendable

A contract error code that a failed Soroban simulation reports.

The host error of a failed simulation either names the contract error directly (Error(Contract, #N)) or masks it: a failing constructor surfaces as Error(Context, ...) and a failing __check_auth as Error(Auth, ...), and the code then appears only in the diagnostic events of the response.

For a masked failure the earliest diagnostic event of a failed call whose topics are the symbol error and a contract error is selected. This is a heuristic, not a proven cause: an earlier error that a contract caught, several failing contracts, or an unrelated error rolled back with the call can be selected instead of the error that ended the simulation, and a code from a contract outside the OpenZeppelin smart-account suite can collide with a code of OZContractErrorCodes. Diagnostic events are present only when the RPC server returns them; without them a code is available only when the host error names it directly.

  • Where a failed simulation reports the contract error code.

    See more

    Declaration

    Swift

    public enum Provenance : Equatable, Hashable, Sendable
  • The contract error code N.

    Declaration

    Swift

    public let code: UInt32
  • Where the failure reports the code.

    Declaration

    Swift

    public let provenance: Provenance
  • The contract that emitted the selected event, as a C... strkey; nil for hostError and for an event without a contract ID.

    Declaration

    Swift

    public let contractId: String?
  • Creates a reported contract error.

    Declaration

    Swift

    public init(code: UInt32, provenance: Provenance, contractId: String?)

    Parameters

    code

    The contract error code.

    provenance

    Where the failure reports the code.

    contractId

    The emitting contract as a C... strkey, or nil.