Mailglass.TemplateError exception (Mailglass v0.1.0)

Copy Markdown View Source

Raised when a template cannot be compiled or rendered.

Types

  • :heex_compile — HEEx compilation failed (syntax, unclosed tag, etc.)
  • :missing_assign — a required assign was not provided to render/3
  • :helper_undefined — a helper function referenced in the template is not defined
  • :inliner_failed — Premailex (or alternative CSS inliner) raised

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.TemplateError{
  __exception__: true,
  cause: Exception.t() | nil,
  context: %{required(atom()) => term()},
  message: String.t(),
  type: :heex_compile | :missing_assign | :helper_undefined | :inliner_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.TemplateError struct.

Options

  • :cause — an underlying exception to wrap (kept out of JSON output).
  • :context — a map of non-PII metadata; :assign is used to fill in the missing-assign message.