# `IIIFImagePlug.V3.RequestError`
[🔗](https://codeberg.org/dainst/iiif_image_plug/src/tag/1.0.1/lib/iiif_image_plug/v3/request_error.ex#L1)

Used to inject an error code, message and response headers from your application into the plug
when a `c:IIIFImagePlug.V3.info_metadata/1` or `c:IIIFImagePlug.V3.data_metadata/1` is invalid (for
example if the identifier does not match anything, 404, or the image is currently access restricted
401 or 403).

## Fields

- `:status_code` (required) a HTTP status code.
- `:msg` (optional) an optional message, by default the plug will put that message in the response's json body. This can also be used
to be picked up by a custom `c:IIIFImagePlug.V3.send_error/3` implementation later on.
- `:response_headers` (optional) a list of key-value tuples that should be set as response headers for the error response.

## Example

    %RequestError{
      code: 401,
      msg: :unauthorized,
      response_headers: [{"something-key", "something value"}]
    }

# `t`

```elixir
@type t() :: %IIIFImagePlug.V3.RequestError{
  msg: atom(),
  response_headers: [tuple()],
  status_code: pos_integer()
}
```

---

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