# `Loopback.HTTPError`
[🔗](https://github.com/stefanchrobot/loopback/blob/v0.1.0/lib/loopback/http_error.ex#L1)

An HTTP transport error, like a timeout, returned by the fakes instead of a response.

## Fields

  * `:reason` - the reason of the error, like `:timeout`, `:closed` or `:econnrefused`.

# `t`

```elixir
@type t() :: %Loopback.HTTPError{reason: term()}
```

An HTTP transport error, returned by the fakes instead of a response.

# `closed`

```elixir
@spec closed() :: t()
```

Builds an error for a closed connection, with the reason `:closed`.

# `connection_refused`

```elixir
@spec connection_refused() :: t()
```

Builds an error for a refused connection, with the reason `:econnrefused`.

# `new`

```elixir
@spec new(map() | keyword()) :: t()
```

Builds an error from a map or a keyword list of its fields.

Raises `ArgumentError` when `:reason` is missing.

## Examples

    Loopback.HTTPError.new(reason: :nxdomain)

# `timeout`

```elixir
@spec timeout() :: t()
```

Builds an error for a timeout, with the reason `:timeout`.

---

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