# `LeXtract.Error.Invalid.Template`
[🔗](https://github.com/YgorCastor/lextract.git/blob/main/lib/lextract/error/invalid/template.ex#L1)

Error for invalid template structure or content.

Raised when template data is malformed, missing required fields,
or has invalid structure.

## Examples

    iex> error = LeXtract.Error.Invalid.Template.exception(
    ...>   reason: "Template must have a non-empty description"
    ...> )
    iex> Exception.message(error)
    "Invalid template: Template must have a non-empty description"

    iex> error = LeXtract.Error.Invalid.Template.exception(
    ...>   reason: "Examples must be a list",
    ...>   template_path: "/tmp/template.json"
    ...> )
    iex> String.contains?(Exception.message(error), "/tmp/template.json")
    true

# `t`

```elixir
@type t() :: %LeXtract.Error.Invalid.Template{
  __exception__: term(),
  bread_crumbs: term(),
  class: term(),
  path: term(),
  reason: String.t(),
  splode: term(),
  stacktrace: term(),
  template_path: String.t() | nil,
  vars: term()
}
```

# `exception`

```elixir
@spec exception(opts :: Keyword.t()) :: %LeXtract.Error.Invalid.Template{
  __exception__: term(),
  bread_crumbs: term(),
  class: term(),
  path: term(),
  reason: term(),
  splode: term(),
  stacktrace: term(),
  template_path: term(),
  vars: term()
}
```

Create an `Elixir.LeXtract.Error.Invalid.Template` without raising it.

## Keys

- :reason
- :template_path

# `message`

```elixir
@spec message(t()) :: String.t()
```

Formats the error message for template validation errors.

---

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