IIIFImagePlug.V3.RequestError (IIIFImagePlug v0.7.0)

View Source

Used to inject an error code, message and response headers from your application into the plug when a IIIFImagePlug.V3.info_metadata/1 or 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 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"}]
}

Summary

Types

t()

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