Mailglass.SendError exception (Mailglass v0.1.0)

Copy Markdown View Source

Raised when email delivery fails.

Types

  • :adapter_failure — the Swoosh adapter returned an error (retryable)
  • :rendering_failed — HEEx or CSS-inlining pipeline failed
  • :preflight_rejected — suppression or rate-limit check blocked the send
  • :serialization_failed — message could not be serialized for the adapter

Per-kind Fields

  • :delivery_id — binary reference to the failed %Mailglass.Delivery{} record when available (lands in Phase 2). nil when the failure occurred before the delivery row was persisted.

See Mailglass.Error for the shared contract and docs/api_stability.md for the locked :type atom set.

Summary

Functions

Returns the closed set of valid :type atoms. Tested against docs/api_stability.md.

Types

t()

@type t() :: %Mailglass.SendError{
  __exception__: true,
  cause: Exception.t() | nil,
  context: %{required(atom()) => term()},
  delivery_id: binary() | nil,
  message: String.t(),
  type:
    :adapter_failure
    | :rendering_failed
    | :preflight_rejected
    | :serialization_failed
}

Functions

__types__()

(since 0.1.0)
@spec __types__() :: [atom()]

Returns the closed set of valid :type atoms. Tested against docs/api_stability.md.

new(type, opts \\ [])

(since 0.1.0)
@spec new(
  atom(),
  keyword()
) :: t()

Build a Mailglass.SendError struct.

Options

  • :cause — an underlying exception to wrap (kept out of JSON output).
  • :context — a map of non-PII metadata about the failure.
  • :delivery_id — the %Mailglass.Delivery{} id when available.