Tagged error type returned by every public function in Image.Plug.
An error carries a stable :tag (an atom suitable for pattern matching
and for mapping to HTTP status codes), a human-readable :message,
and optional :details for diagnostic context.
Errors are returned as {:error, %Image.Plug.Error{}}. They are not
raised — try/rescue is reserved for true system boundaries per the
project's code style.
Summary
Types
A stable error tag. The set is open; callers should match the tags
documented for the function they call and treat unknown tags as :internal.
Types
@type tag() ::
:unknown_option
| :invalid_option
| :malformed_url
| :variant_not_found
| :variant_already_exists
| :source_not_found
| :source_fetch_error
| :source_too_large
| :unsupported_source_format
| :unsupported_output_format
| :unsupported_option
| :output_too_large
| :request_timeout
| :pipeline_failed
| :signature_required
| :invalid_signature
| :signature_expired
| :not_implemented
| :internal
A stable error tag. The set is open; callers should match the tags
documented for the function they call and treat unknown tags as :internal.
Functions
Builds an error struct.
Arguments
tagis an atom fromtag/0describing the error class.messageis a human-readable description of the failure.
Options
:detailsis a map of extra diagnostic context. Defaults to%{}.
Returns
- An
Image.Plug.Errorstruct.
Examples
iex> error = Image.Plug.Error.new(:unknown_option, "no such option", details: %{key: "wat"})
iex> error.tag
:unknown_option
iex> error.details
%{key: "wat"}
Maps an error tag to a default HTTP status code.
Arguments
error_or_tagis either anImage.Plug.Errorstruct or an error tag atom.
Returns
- An integer HTTP status code.
Examples
iex> Image.Plug.Error.status(:variant_not_found)
404
iex> Image.Plug.Error.status(Image.Plug.Error.new(:invalid_option, "bad"))
400
iex> Image.Plug.Error.status(:internal)
500