Lemma.EngineError (lemma_engine v0.9.2)

Copy Markdown View Source

Structured engine error as returned by NIF error paths (load, show, run, format, …). Keys are atoms (Rustler encoding), not JSON strings.

Call from_map/1 on an error map (or each element of a load-error list) to get a typed struct.

Summary

Functions

Builds a Lemma.EngineError from an atom-keyed error map returned by a NIF.

Types

source()

@type source() :: %{
  attribute: String.t(),
  line: non_neg_integer(),
  column: non_neg_integer(),
  length: non_neg_integer()
}

t()

@type t() :: %Lemma.EngineError{
  actual_value: String.t() | nil,
  kind: String.t(),
  limit_name: String.t() | nil,
  limit_value: String.t() | nil,
  message: String.t(),
  registry_kind: String.t() | nil,
  related_data: String.t() | nil,
  related_spec: String.t() | nil,
  repository: String.t() | nil,
  request_kind: String.t() | nil,
  source: source() | nil,
  spec: String.t() | nil,
  suggestion: String.t() | nil
}

Functions

from_map(map)

@spec from_map(map()) :: t()

Builds a Lemma.EngineError from an atom-keyed error map returned by a NIF.

Raises KeyError if :kind or :message is missing.