Predicator.Errors.EvaluationError (predicator v2.2.0)

View Source

Error struct for general evaluation errors in Predicator evaluation.

This error occurs for runtime evaluation problems like division by zero, function call errors, or insufficient operands.

Fields

  • message - Human-readable error description
  • reason - Structured reason code for the error
  • operation - The operation that failed (optional)

Examples

%Predicator.Errors.EvaluationError{
  message: "Division by zero",
  reason: "division_by_zero",
  operation: :divide
}

%Predicator.Errors.EvaluationError{
  message: "Function len() expects 1 arguments, got 0",
  reason: "insufficient_arguments",
  operation: :function_call
}

Summary

Functions

Creates an evaluation error for insufficient operands.

Creates an evaluation error.

Types

t()

@type t() :: %Predicator.Errors.EvaluationError{
  message: binary(),
  operation: atom() | nil,
  reason: binary()
}

Functions

insufficient_operands(operation, got, expected)

@spec insufficient_operands(atom(), integer(), integer()) :: t()

Creates an evaluation error for insufficient operands.

new(message, reason, operation \\ nil)

@spec new(binary(), binary(), atom() | nil) :: t()

Creates an evaluation error.