Typsty.SyntaxError exception (Typsty v0.1.0)

Copy Markdown View Source

A template has invalid Typst syntax, or a component breaks the rules for components (see Typsty.Component). Raised when a module with a ~TYPST sigil or a .typ template is compiled (or a component, with the .typ files in its folder), so that the problem fails the build instead of a render, and when mix format formats one with Typsty.Formatter.

:diagnostics has every problem in the template, and :file, :line and :column point at the first one. :kind is :syntax for syntax errors, and :component for breaking the rules for components: content at their top level, reading sys.inputs, or reading a file they don't have.

Summary

Types

t()

@type t() :: %Typsty.SyntaxError{
  __exception__: term(),
  column: pos_integer() | nil,
  diagnostics: [Typsty.Diagnostic.t()],
  file: String.t() | nil,
  kind: :syntax | :component,
  line: pos_integer() | nil,
  snippet: String.t() | nil
}