Skip to main content

Error handling

All SDK errors extend FourMicaError. Import the specific classes to branch on failure type. The Auth* family also includes AuthUrlError, AuthTransportError, AuthDecodeError, AuthApiError, and AuthConfigError, all extending AuthError.

Coded refusals

When core refuses with a stable code, the SDK throws a CoreRefusalError subclass carrying the decoded details. Each extends RpcError, so handlers written against RpcError keep catching them; branch on the class (or .code), not the message.

Receipt errors

client.payment.verifyGuarantee and verifyGuaranteeReceipt throw these PaymentErrors:

Distinguishing errors

Import the classes you want to handle and branch with instanceof.
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.