# 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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cloud4.ai/sdk/errors.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
