```tsx
import {createAiChat, ErrorCallback, ErrorEventDetails} from '@nlux/core';

const aiChat = createAiChat().withAdapter(adapter);
const errorCallback: ErrorCallback = (errorDetails: ErrorEventDetails) => {
    console.log(errorDetails.errorId);
    console.log(errorDetails.message);
};
```

```tsx
// Registering the errorCallback when creating the AiChat instance
const aiChat = createAiChat().withAdapter(adapter).on('error', errorCallback);
```

```tsx
// Registering the errorCallback after creating the AiChat instance
aiChat.on('error', errorCallback);
```

```tsx
// Unregistering the errorCallback
aiChat.removeEventListener('error', errorCallback);
```
