LeXtract.Error.External.TemplateRead exception (lextract v0.1.2)

View Source

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

Summary

Functions

Formats the error message for template read failures.

Types

t()

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

Functions

exception(args)

@spec exception(opts :: Keyword.t()) :: %LeXtract.Error.External.TemplateRead{
  __exception__: true,
  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(exception)

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

Formats the error message for template read failures.