Error handling
All SDK errors extendFourMicaError. Import the specific classes to branch on failure type.
| Error | When it is thrown |
|---|---|
ConfigError | Invalid ConfigBuilder input. |
RpcError | The 4Mica core service returned an error. Carries .status and .body. |
SigningError | The signing scheme is unsupported, or the signer address does not match the claims. |
ContractError | An on-chain call failed or returned an unexpected result. |
VerificationError | A BLS certificate failed to decode or its domain did not match. |
X402Error | An x402 flow error: bad scheme, tab resolution, or settlement. |
AuthError | Base class for all authentication errors. |
AuthMissingConfigError | login() was called but auth is not configured. |
Auth* family also includes AuthUrlError, AuthTransportError, AuthDecodeError, AuthApiError, and AuthConfigError, all extending AuthError.
Distinguishing errors
Import the classes you want to handle and branch withinstanceof.
Every error extends
FourMicaError, so you can catch that base class to handle
any SDK failure in one place.Next steps
Overview
Install the SDK and see the capabilities at a glance.
Client operations
Deposit collateral, sign payments, and settle cleared cycles.