HttpEtag.Error exception (HttpEtag v0.1.0)

Copy Markdown View Source

Exception returned or raised by HttpEtag.

Untrusted field text returns {:error, exception} (or the bang variant raises). Programmer mistakes raise ArgumentError instead.

  • :invalid_etag - the value is not a single entity-tag
  • :invalid_header - the field is not "*" or #entity-tag
  • :precondition_failed - If-Match or If-None-Match is not satisfied

Examples

iex> Exception.message(%HttpEtag.Error{reason: :invalid_etag})
"invalid entity-tag"

iex> Exception.message(%HttpEtag.Error{reason: :invalid_header})
"invalid If-Match or If-None-Match header"

iex> Exception.message(%HttpEtag.Error{reason: :precondition_failed})
"precondition failed"

Summary

Types

reason()

@type reason() :: :invalid_etag | :invalid_header | :precondition_failed

t()

@type t() :: %HttpEtag.Error{__exception__: true, reason: reason()}