Skip to main content
Contract calls can revert with on-chain errors. The SDK decodes raw revert data into typed error classes with decoded arguments and human-readable recovery hints.

Decoding revert errors

Use parseContractError() to decode raw revert data from a failed transaction or simulation:

getRevertData(error)

Walks the error cause chain and extracts the first 0x-prefixed hex string from error.data. Returns null if no revert data is found.

parseContractError(revertData)

Takes a hex string (selector + encoded args) and returns a typed ContractErrorBase or null if the error is not recognized.

ContractErrorBase

All typed errors implement this interface:

Simulation with error decoding

Use simulateWithErrorDecode() to wrap a simulateContract call. It catches reverts, decodes them, and re-throws as typed SDK errors:
Or use the simulate namespace directly on any entity — it already throws typed errors:

Error types by contract

GlobalParams errors

CampaignInfoFactory errors

CampaignInfo errors

PaymentTreasury errors

AllOrNothing errors

KeepWhatsRaised errors

TreasuryFactory errors

Shared errors (cross-contract)

Checking error types

getRecoveryHint

Convenience function to extract the recovery hint from any typed error: