# `Wardrik.Error`

An operation's failure, as the protocol's `error`.

    %Wardrik.Error{type: :not_found, message: "No agent acme/triage."}

`type` is one of `t:type/0`. `message` is for people to read.

# `t`

```elixir
@type t() :: %Wardrik.Error{__exception__: term(), message: String.t(), type: type()}
```

# `type`

```elixir
@type type() ::
  :invalid_request
  | :unauthorized
  | :forbidden
  | :not_found
  | :conflict
  | :not_supported
  | :unavailable
  | :internal
```

# `json`

```elixir
@spec json(t()) :: map()
```

Returns `error` as the protocol's JSON error body.

    Wardrik.Error.json(Wardrik.Error.new(:not_found, "No agent acme/triage."))
    #=> %{"error" => %{"type" => "not_found", "message" => "No agent acme/triage."}}

# `new`

```elixir
@spec new(type(), String.t()) :: t()
```

Returns an error of `type` with `message`.

---

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