# Error

#### Description

This event is triggered when an error occurs in rce.js

#### Parameters

```typescript
{ server?: IServer, error: string }
```

#### Example

{% tabs %}
{% tab title="TypeScript" %}

```javascript
import { RCEEvent, type IErrorEventPayload } from "rce.js";

// ...

rce.on(RCEEvent.Error, (payload: IErrorEventPayload) => {
    console.error(`${payload.server ? `[${payload.server.identifier}]: ${payload.error}` : payload.error}`);
});
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const { RCEEvent } = require("rce.js");

// ...

rce.on(RCEEvent.Error, (payload) => {
    console.error(`${payload.server ? `[${payload.server.identifier}]: ${payload.error}` : payload.error}`);
});
```

{% endtab %}
{% endtabs %}
