---
id: "T:cAlgo.API.HttpException"
kind: "class"
namespace: "cAlgo.API"
url: "https://help.ctrader.com/ctrader-algo/references/HTTP/HttpException/"
---

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

# HttpException (class)

Represents errors that may occur during HTTP request

Environments: Desktop supported · CLI supported · Cloud supported.

## Definition

```csharp
public sealed class HttpException : Exception
```

## Examples

C#:

```csharp
var response = Http.Get("https://api.example.com/quotes");
if (!response.IsSuccessful && response.Exception != null)
    Print("HTTP request failed: {0}", response.Exception.Message);
```

Python:

```python
response = api.Http.Get("https://api.example.com/quotes")
if not response.IsSuccessful and response.Exception is not None:
    api.Print(f"HTTP request failed: {response.Exception.Message}")
```

