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

# Error Handling

> Understand how errors are returned and handled in the Monei SDK.

# Overview

All SDK methods throw a `MoneiError` on failure. Always wrap calls in try/catch:

```typescript theme={null}
import MoneiSDK, { MoneiError } from 'monei-sdk';

try {
  const tx = await monei.payout.bankTransfer({ ... });
} catch (err) {
  if (err instanceof MoneiError) {
    console.error(err.statusCode);  // HTTP status code
    console.error(err.message);     // Human-readable error
    console.error(err.code);        // Machine-readable error code
  }
}
```

### Common Error Codes

| Code                 | HTTP Status | Meaning                                      |
| -------------------- | ----------- | -------------------------------------------- |
| `UNAUTHORIZED`       | 401         | Missing or invalid API key / bearer token    |
| `FORBIDDEN`          | 403         | Insufficient permissions or KYC tier too low |
| `NOT_FOUND`          | 404         | Resource does not exist                      |
| `VALIDATION_ERROR`   | 422         | Invalid request body                         |
| `INSUFFICIENT_FUNDS` | 400         | Wallet balance too low                       |
| `RATE_LIMITED`       | 429         | Too many requests — back off and retry       |
| `INTERNAL_ERROR`     | 500         | Something went wrong on our end              |

***
