Version: v0.7.0

closed_function_error

Stable error · Expressions

Tier: stable · Kind: error · Topic: Expressions

JuliaTypeScriptPythonRustGo
ClosedFunctionErrorClosedFunctionErrornot exportedClosedFunctionErrorClosedFunctionError

Julia

struct ClosedFunctionError <: EarthSciASTError
ClosedFunctionError(code::String, message::String)
ClosedFunctionError(code, message)
ClosedFunctionError(code::String, message::String)

Raised by the closed function registry when the spec contract is violated. code is one of the stable diagnostic codes pinned by esm-spec §9.1–§9.2:

  • unknown_closed_function — fn-op name is not in the v0.3.0 set.
  • closed_function_arity — wrong number of arguments for the named function.
  • closed_function_overflow — integer-typed result would overflow Int32.
  • searchsorted_non_monotonic — xs is not non-decreasing.
  • searchsorted_nan — xs contains a NaN entry (checked before monotonicity).
  • interp_axis_not_const — interp.searchsorted’s xs is not a rank-1 array of numbers (a scalar, a nested array); checked before searchsorted_nan.
  • interp_non_monotonic_axis — interp.linear / interp.bilinear axis is not strictly increasing (esm-spec §9.2; equal-adjacent rejected because the blend denominator would be zero).
  • interp_axis_length_mismatch — interp.linear: len(table) != len(axis); interp.bilinear: len(table) != len(axis_x), or any inner row length differs from len(axis_y).
  • interp_nan_in_axis — any axis (or axis_x, axis_y) contains a value that is not finite (NaN, +Inf or -Inf; ruling Q-113).
  • interp_axis_too_short — any axis has fewer than 2 entries.
  • interp_table_not_const / interp_axis_not_const — table / axis (or interp.searchsorted xs) argument is not a literal const-op array of the required rank (e.g. a variable reference, a scalar const, a nested array where a flat one belongs; ruling Q-108). Raised at load and by validate() on every interp.* fn node (load_time_checks.jl), by the build’s const-arg protocol and the MTK lowering, and — for a value of the wrong rank — by evaluate_closed_function itself.

Source

TypeScript

class ClosedFunctionError extends EsmDiagnosticError
new ClosedFunctionError(code: ClosedFunctionErrorCode, message: string): ClosedFunctionError

Error thrown by closed function dispatch and load-time table validation. code identifies the spec-pinned diagnostic; cross-binding harnesses compare against this exact string.

Source

Python

Python does not export this error.

Rust

pub struct ClosedFunctionError {
    pub code: String,
    pub message: String,
}

impl ClosedFunctionError { pub fn new(code: impl Into<String>, message: impl Into<String>) -> Self }

Error type for closed-function dispatch failures (esm-spec §9.1–§9.2).

The code field carries one of the stable diagnostic codes pinned by the spec; downstream tooling pattern-matches on these strings. The set is kept in lockstep with the Julia / Python / TypeScript / Go bindings.

Source · Rust docs

Go

type ClosedFunctionError struct {
	Code    string
	Message string
}

func (e *ClosedFunctionError) DiagnosticCode() string

func (e *ClosedFunctionError) Error() string

ClosedFunctionError carries the spec-defined diagnostic codes pinned by esm-spec §9.1–§9.2 / §9.3:

  • unknown_closed_function — fn name is not in the v0.3.0 set.
  • closed_function_arity — wrong number of arguments.
  • closed_function_overflow — integer-typed result would overflow Int32.
  • searchsorted_non_monotonic — xs is not non-decreasing.
  • searchsorted_nan — xs contains a NaN entry (checked before monotonicity).
  • interp_axis_not_const — an axis, or searchsorted’s xs, is not a rank-1 const array (checked before searchsorted_nan).
  • interp_table_not_const — an interp.linear/bilinear table is not a const array of rank 1 (linear) or rank 2 (bilinear).
  • interp_non_monotonic_axis — interp.linear/bilinear axis is not strictly increasing.
  • interp_axis_length_mismatch — table shape disagrees with axis length(s).
  • interp_nan_in_axis — interp.linear/bilinear axis contains NaN.
  • interp_axis_too_short — interp.linear/bilinear axis has fewer than 2 entries.

Methods

func (e *ClosedFunctionError) DiagnosticCode() string

DiagnosticCode returns the stable diagnostic code (DiagnosticError).

func (e *ClosedFunctionError) Error() string

Source · Go docs