# `Mailglass.TemplateError`
[🔗](https://github.com/szTheory/mailglass/blob/v0.1.0/lib/mailglass/errors/template_error.ex#L1)

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.

# `t`

```elixir
@type t() :: %Mailglass.TemplateError{
  __exception__: true,
  cause: Exception.t() | nil,
  context: %{required(atom()) =&gt; term()},
  message: String.t(),
  type: :heex_compile | :missing_assign | :helper_undefined | :inliner_failed
}
```

# `__types__`
*since 0.1.0* 

```elixir
@spec __types__() :: [atom()]
```

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

# `new`
*since 0.1.0* 

```elixir
@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.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
