> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dzap.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Trade Failure Actions

> How to handle contractErrorActions when trade() fails.

When `trade()` fails, check `result.action` and handle accordingly:

| Action               | Meaning                  | Suggested handling                                                                        |
| -------------------- | ------------------------ | ----------------------------------------------------------------------------------------- |
| `TRY_ANOTHER_ROUTE`  | Recommended route failed | Rebuild `data` with `protocol: bestReturnSource` from the quote and call `trade()` again. |
| `INCREASE_SLIPPAGE`  | Slippage too low         | Ask user to increase slippage and retry.                                                  |
| `INCREASE_ALLOWANCE` | Allowance insufficient   | Re-run allowance/approval flow and retry.                                                 |

Example:

```typescript theme={null}
if (result.status !== TxnStatus.success && result.action === "TRY_ANOTHER_ROUTE") {
  const fallbackData = request.data.map((d, i) => {
    const pairKey = Object.keys(quotes)[i];
    const fallbackSource = quotes[pairKey]?.bestReturnSource;
    return fallbackSource ? { ...d, protocol: fallbackSource } : d;
  });
  result = await dZap.trade({ request: { ...request, data: fallbackData }, signer });
}
```

## Next steps

* [DZapTransactionResponse](/sdk/reference/errors/dzap-transaction-response)
* [contractErrorActions](/sdk/reference/enums/contract-error-actions)
