Volt.Dev.Error (Volt v0.19.2)

Copy Markdown View Source

JSON-safe error entries for the development error overlay.

Build errors arrive as OXC.Diagnostic maps, compiler messages, exceptions, or arbitrary terms. entries/2 turns any of them into maps the browser overlay renders, with a source frame when the file and line are known.

With the optional :lumis dependency and a Lumis parser package for the file's language, such as :lumis_wasm_typescript, entries also carry frame_html, the frame with syntax highlighting.

Summary

Functions

Build overlay entries from an error reason.

Types

entry()

@type entry() :: %{
  title: String.t(),
  message: String.t(),
  file: String.t() | nil,
  line: pos_integer() | nil,
  column: pos_integer() | nil,
  hint: String.t() | nil,
  frame: String.t() | nil,
  frame_html: String.t() | nil,
  stack: String.t() | nil
}

Functions

entries(reason, opts \\ [])

@spec entries(
  term(),
  keyword()
) :: [entry()]

Build overlay entries from an error reason.

Options

  • :file — the source path the errors belong to. It names entries that have no file or only its basename, and is read for source frames.
  • :title — the overlay heading for these errors. Default: "Build error"