> For the complete documentation index, see [llms.txt](https://docs.one-record.fr/one-record/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.one-record.fr/one-record/notification/socketio/handling-errors.md).

# Handling Errors

Any errors that occur during the WebSocket connection process or during communication with the server are emitted to the client through the **error** event. These errors may arise from authentication issues, connection failures, or server-side problems.

### Error format

Each error object contains the following properties :

* message : A human-readable string describing the error (e.g., "Unauthorized").
* timestamp: The time when the error occurred, in ISO 8601 format (e.g., "2023-09-24T12:34:56.789Z").

#### Example error response

```json
{
  "message": "Unauthorized",
  "timestamp": "2023-09-24T12:34:56.789Z"
}
```

### Example Error Handling

You can handle these errors by listening for the **error** event as shown in the following example:

```javascript
const socket = io('https://ws.one-record.fr/<namespace>', {
  auth: {
    access_token: 'wrong-token',
  },
});

socket.on('error', (error) => {
  console.error('Error received:', error);
});
```
