# `Medplum.Error`
[🔗](https://github.com/CodeDuckers-LLC/medplum_elixir/blob/v0.3.0/lib/medplum/error.ex#L1)

Stable error shape returned by Medplum requests.

# `t`

```elixir
@type t() :: %Medplum.Error{
  __exception__: term(),
  body: term() | nil,
  message: String.t(),
  reason: term() | nil,
  status: non_neg_integer() | nil,
  type: type()
}
```

Structured error returned by Medplum operations.

# `type`

```elixir
@type type() ::
  :config_error
  | :auth_failed
  | :request_failed
  | :api_error
  | :invalid_response
```

Error categories returned by configuration, auth, transport, and API failures.

# `new`

```elixir
@spec new(
  type(),
  keyword()
) :: t()
```

Builds a new error struct with a generated message.

---

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