---
id: "M:cAlgo.API.Plugin.OnError(cAlgo.API.Error)"
kind: "method"
type: "T:cAlgo.API.Plugin"
url: "https://help.ctrader.com/ctrader-algo/references/General/Plugin/OnError/"
---

> Documentation index for agents: https://help.ctrader.com/ctrader-algo/llms.txt · machine index: https://help.ctrader.com/ctrader-algo/api.json

# Plugin.OnError

Member of [Plugin](https://help.ctrader.com/ctrader-algo/references/General/Plugin/index.md).

## OnError(Error error)

Called if there is an error executing a trade operation.

Environments: Desktop supported · CLI not supported · Cloud not supported.

- CLI: Plugins cannot run in the CLI: ctrader-cli runs cBots only.
- Cloud: Plugins cannot run in the cloud: it runs cBots only.

C#:

```csharp
protected internal void OnError(Error error)
```

Python:

```python
api.OnError(error: Error) -> None
```

### Parameters

- `error` (`Error`, Python `Error`): Error description.

### Examples

C#:

```csharp
protected override void OnError(Error error)
{
    Print("There has been an Error");
}
```

Python:

```python
def on_error(self, error):
    print("There has been an Error")
```

