TOOLS

Error Recovery

Trigger representative `MoneyError` cases and practice deterministic, code-driven recovery sequences.

Human Flow

Pick a scenario, run failure mode, inspect code/message/note, then execute recovery.

state: idle

Scenario Selector

Expected code: CHAIN_NOT_CONFIGUREDCalls balance on an unconfigured chain to force setup guidance.

Error Output

Run scenario to inspect structured error output.

Retry Panel (Adjusted Inputs)

Failing request

{
  "chain": "demo-unconfigured",
  "network": "mainnet"
}

Adjusted recovery request

{
  "chain": "base",
  "network": "mainnet"
}

Recovery sequence

await money.setup({ chain: "base", network: "mainnet" });
await money.balance({ chain: "base", network: "mainnet" });

Run recovery to execute the adjusted sequence.

Agent Flow

Scenario-specific failure payloads and deterministic recovery patterns.

Scenario: Missing chain setup

SDK method
CALLmoney.balance
- Expected error code: CHAIN_NOT_CONFIGURED
- Calls balance on an unconfigured chain to force setup guidance.
- Recovery snippet: await money.setup({ chain: "base", network: "mainnet" }); await money.balance({ chain: "base", network: "mainnet" });
# SDK method (no HTTP endpoint)
# Use JavaScript snippet instead.
Example success response
{
  "code": "CHAIN_NOT_CONFIGURED",
  "message": "Expected CHAIN_NOT_CONFIGURED from scenario.",
  "note": "Inspect note and apply recovery snippet."
}
Example failure responses
Failure
{
  "status": "unexpected_success",
  "message": "Scenario did not fail as expected in this environment."
}
Recovery: Use the route `/api/errors/run` response to confirm actual runtime behavior.
Failure
{
  "status": "recovery_failed",
  "code": "CHAIN_NOT_CONFIGURED"
}
Recovery: Apply recovery snippet in sequence and retry.

Scenario: Invalid address format

SDK method
CALLmoney.send
- Expected error code: INVALID_ADDRESS
- Calls send with an invalid address string.
- Recovery snippet: const checks = await money.identifyChains({ address: "0x1111111111111111111111111111111111111111" }); console.log(checks.chains);
# SDK method (no HTTP endpoint)
# Use JavaScript snippet instead.
Example success response
{
  "code": "INVALID_ADDRESS",
  "message": "Expected INVALID_ADDRESS from scenario.",
  "note": "Inspect note and apply recovery snippet."
}
Example failure responses
Failure
{
  "status": "unexpected_success",
  "message": "Scenario did not fail as expected in this environment."
}
Recovery: Use the route `/api/errors/run` response to confirm actual runtime behavior.
Failure
{
  "status": "recovery_failed",
  "code": "INVALID_ADDRESS"
}
Recovery: Apply recovery snippet in sequence and retry.

Scenario: Insufficient balance

SDK method
CALLmoney.send
- Expected error code: INSUFFICIENT_BALANCE
- Attempts to send an intentionally huge amount after setup.
- Recovery snippet: await money.faucet({ chain: "fast", network: "testnet" }); await money.send({ chain: "fast", network: "testnet", to: "<valid fast1...>", amount: "1" });
# SDK method (no HTTP endpoint)
# Use JavaScript snippet instead.
Example success response
{
  "code": "INSUFFICIENT_BALANCE",
  "message": "Expected INSUFFICIENT_BALANCE from scenario.",
  "note": "Inspect note and apply recovery snippet."
}
Example failure responses
Failure
{
  "status": "unexpected_success",
  "message": "Scenario did not fail as expected in this environment."
}
Recovery: Use the route `/api/errors/run` response to confirm actual runtime behavior.
Failure
{
  "status": "recovery_failed",
  "code": "INSUFFICIENT_BALANCE"
}
Recovery: Apply recovery snippet in sequence and retry.

Scenario: Mainnet-only swap constraint

SDK method
CALLmoney.quote
- Expected error code: UNSUPPORTED_OPERATION
- Runs quote on testnet to trigger mainnet-only guardrails.
- Recovery snippet: await money.quote({ chain: "base", from: "ETH", to: "USDC", amount: "1", network: "mainnet" });
# SDK method (no HTTP endpoint)
# Use JavaScript snippet instead.
Example success response
{
  "code": "UNSUPPORTED_OPERATION",
  "message": "Expected UNSUPPORTED_OPERATION from scenario.",
  "note": "Inspect note and apply recovery snippet."
}
Example failure responses
Failure
{
  "status": "unexpected_success",
  "message": "Scenario did not fail as expected in this environment."
}
Recovery: Use the route `/api/errors/run` response to confirm actual runtime behavior.
Failure
{
  "status": "recovery_failed",
  "code": "UNSUPPORTED_OPERATION"
}
Recovery: Apply recovery snippet in sequence and retry.

Scenario: Invalid params

SDK method
CALLmoney.toRawUnits
- Expected error code: INVALID_PARAMS
- Calls conversion without enough decimal context.
- Recovery snippet: await money.toRawUnits({ amount: "25", decimals: 6 });
# SDK method (no HTTP endpoint)
# Use JavaScript snippet instead.
Example success response
{
  "code": "INVALID_PARAMS",
  "message": "Expected INVALID_PARAMS from scenario.",
  "note": "Inspect note and apply recovery snippet."
}
Example failure responses
Failure
{
  "status": "unexpected_success",
  "message": "Scenario did not fail as expected in this environment."
}
Recovery: Use the route `/api/errors/run` response to confirm actual runtime behavior.
Failure
{
  "status": "recovery_failed",
  "code": "INVALID_PARAMS"
}
Recovery: Apply recovery snippet in sequence and retry.