LeXtract.Error.Invalid.Template exception (lextract v0.1.2)

View Source

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

Summary

Functions

Formats the error message for template validation errors.

Types

t()

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

Functions

exception(args)

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

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

Formats the error message for template validation errors.