MailKite.Error exception (MailKite v0.13.0)

Copy Markdown View Source

Raised/returned for any non-2xx MailKite API response.

  • :status — the HTTP status code.
  • :message — the API's error field when present, otherwise "HTTP <status>".
  • :body — the parsed response body (any JSON value), for inspection.

MailKite.Client.request/4 returns {:error, %MailKite.Error{}}; the struct is also an exception, so you may raise it when you prefer exception-style flow.

Summary

Types

t()

@type t() :: %MailKite.Error{
  __exception__: true,
  body: any(),
  message: String.t() | nil,
  status: non_neg_integer() | nil
}