# `LeXtract.Error.External.TemplateRead`
[🔗](https://github.com/YgorCastor/lextract.git/blob/main/lib/lextract/error/external/template_read.ex#L1)

Error for template file I/O failures.

Raised when a template file cannot be read from disk, typically
due to missing files, permission issues, or I/O errors.

## Examples

    iex> error = LeXtract.Error.External.TemplateRead.exception(
    ...>   file_path: "/tmp/missing.json",
    ...>   reason: :enoent
    ...> )
    iex> String.contains?(Exception.message(error), "missing.json")
    true

    iex> error = LeXtract.Error.External.TemplateRead.exception(
    ...>   file_path: "/etc/protected.json",
    ...>   reason: :eacces
    ...> )
    iex> String.contains?(Exception.message(error), "permission denied")
    true

# `t`

```elixir
@type t() :: %LeXtract.Error.External.TemplateRead{
  __exception__: term(),
  bread_crumbs: term(),
  class: term(),
  file_path: String.t(),
  path: term(),
  reason: atom() | String.t(),
  splode: term(),
  stacktrace: term(),
  vars: term()
}
```

# `exception`

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

Create an `Elixir.LeXtract.Error.External.TemplateRead` without raising it.

## Keys

- :file_path
- :reason

# `message`

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

Formats the error message for template read failures.

---

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