> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://mmg-sdk.wetechnologygroup.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://mmg-sdk.wetechnologygroup.com/_mcp/server.

# Types & Errors

> Handling requests, responses, and API exceptions

## Request And Response Types

The SDK exports all request and response types as TypeScript interfaces. Simply import them using the `MMG` namespace:

```typescript
import { MMG } from "mobile-money-sdk";

const request: MMG.PostECommerceLoginMerRequest = {
    // ... your request data
};
```

## Exception Handling

When the API returns a non-success status code (4xx or 5xx response), a subclass of `MMGError` will be thrown. You can catch these errors to inspect the status code and raw response.

```typescript
import { MMGError } from "mobile-money-sdk";

try {
    await client.authentication.loginResourceTokenApi(...);
} catch (err) {
    if (err instanceof MMGError) {
        console.log(err.statusCode);
        console.log(err.message);
        console.log(err.body);
        console.log(err.rawResponse);
    }
}
```