Liquex.Error exception (liquex v0.15.0)

Copy Markdown View Source

Exception raised for parse and render failures.

In addition to :message, the struct carries structured fields that are useful for tooling:

  • :reason — short reason without surrounding context
  • :line — 1-based line number where the failure was detected
  • :column — 1-based column number
  • :excerpt — multi-line snippet of the source around the failure with a caret
  • :hint — optional follow-up suggestion (e.g. "did you mean if?")
  • :kind:parse or :render

Summary

Functions

Build a render-time Liquex.Error from a free-form message.

Types

t()

@type t() :: %Liquex.Error{
  __exception__: true,
  column: pos_integer() | nil,
  excerpt: String.t() | nil,
  hint: String.t() | nil,
  kind: :parse | :render | nil,
  line: pos_integer() | nil,
  message: String.t() | nil,
  reason: String.t() | nil
}

Functions

from_parser(template, reason, line, column)

@spec from_parser(String.t(), String.t(), pos_integer(), pos_integer()) :: t()

Build a Liquex.Error from a parse failure.

render_error(message)

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

Build a render-time Liquex.Error from a free-form message.