> For the complete documentation index, see [llms.txt](https://docs.cloud4.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cloud4.ai/sdk/errors.md).

# Errors

## C4AI\_SDK\_Error

***

The `C4AI_SDK_Error` class is designed to handle errors and exceptions within the Cloud4.ai SDK. It provides a unified structure for identifying and processing errors, ensuring consistency and reliability in error handling across different parts of the SDK.

### Usage

To use the `C4AI_SDK_Error` class, import it into your project from the Cloud4.ai SDK and initialize it with the appropriate parameters. Here's an example of how to use the class:

```typescript
import { C4AI_SDK_Error } from '@c4ai-sdk/global/C4AISDKError.class';

const error = new C4AI_SDK_Error({
    name: 'EXECUTOR_SIC_MISSING',
    message: 'Executor SIC is missing',
    code: 'C4AI_SDK_EES_00001',
    description: 'Executor SIC is missing in the request. Please make sure you have provided the sic in the request.',
    link: 'https://docs.cloud4.ai/ees/executor-sic'
});
```

### Parameters

| Parameter     | Description                                                                      |
| ------------- | -------------------------------------------------------------------------------- |
| `name`        | The name of the error.                                                           |
| `message`     | The error message.                                                               |
| `code`        | The error code associated with the error.                                        |
| `description` | A detailed description of the error.                                             |
| `link`        | (optional) A link to additional documentation or resources related to the error. |

### Methods

* `toJSON()`: Returns a JSON representation of the error object, including all parameters.
