# `Bourse.HTTP.Errors`
[🔗](https://github.com/ZenHive/bourse/blob/main/lib/bourse/http/errors.ex#L1)

Classifies HTTP and body-level exchange responses into `Bourse.Error` structs.

Extracted from `Bourse.HTTP` so the transport layer can stay focused on request
execution while error taxonomy (status maps, body sentinels, HTML/geo-block
detection) lives in one place. Behavior-preserving delegation only — the
public HTTP API is unchanged.

# `response`

```elixir
@type response() :: %{status: integer(), headers: response_headers(), body: term()}
```

Normalized success response map

# `response_headers`

```elixir
@type response_headers() :: %{optional(String.t()) =&gt; [String.t()]}
```

HTTP response headers as returned by Req

# `classify_response`

```elixir
@spec classify_response(
  atom(),
  integer(),
  response_headers(),
  term(),
  Bourse.Exchange.t()
) ::
  {:ok, response()} | {:error, Bourse.Error.t()}
```

Classifies an HTTP response into `{:ok, response}` or `{:error, Error.t()}`.

Handles 2xx body-level errors, non-2xx status normalization, HTML/geo-block
and Cloudflare challenge detection. Empty 2xx bodies are successful responses.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
