Mailglass.SuppressedError exception (Mailglass v1.0.0)

Copy Markdown View Source

Raised when delivery is blocked by the suppression list.

Suppression is a permanent policy block — the recipient opted out, hard-bounced, or the tenant explicitly excluded them. Never retryable. The :type atoms mirror Mailglass.Suppression.scope for 1:1 match.

Types

  • :address — the recipient address is globally suppressed
  • :domain — the recipient domain is globally suppressed
  • :address_stream — the recipient is suppressed for a specific stream (e.g. :bulk)

Context

Suppression-hit context stays PII-safe while carrying enough diagnostic detail for callers:

  • :tenant_id — stamped tenant
  • :stream — current message stream
  • :reason — suppression reason atom
  • :source — suppression source class/string
  • :expires_at — expiry timestamp or nil

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.SuppressedError{
  __exception__: true,
  cause: Exception.t() | nil,
  context: %{
    optional(:tenant_id) => String.t(),
    optional(:stream) => atom() | nil,
    optional(:reason) => atom() | nil,
    optional(:source) => String.t() | nil,
    optional(:expires_at) => DateTime.t() | nil,
    optional(atom()) => term()
  },
  message: String.t(),
  type: :address | :domain | :address_stream
}

Functions

__types__()

(since 0.1.0)

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.SuppressedError struct.

Options

  • :cause — an underlying exception to wrap (kept out of JSON output).
  • :context — a map of non-PII metadata about the suppression record.