Expression.Error exception (expression v2.49.0)

Copy Markdown

A structured error type for expression parsing and evaluation failures.

Provides a single, consistent error representation across the library, replacing the previous mix of RuntimeError exceptions, {:error, string} tuples, and error maps.

Fields

  • :type - the category of error (:parse, :eval, :type, :function)
  • :message - a human-readable description of what went wrong
  • :expression - the expression string that caused the error, if available
  • :position - the character position in the expression where the error occurred, if available

Summary

Types

error_type()

@type error_type() :: :parse | :eval | :type | :function

t()

@type t() :: %Expression.Error{
  __exception__: true,
  expression: String.t() | nil,
  message: String.t(),
  position: non_neg_integer() | nil,
  type: error_type()
}