Version: dev

enum_lowering_error

Stable error · Load-time lowering and templates

Tier: stable · Kind: error · Topic: Load-time lowering and templates

JuliaTypeScriptPythonRustGo
EnumLoweringErrorEnumLoweringErrorEnumLoweringErrorEnumLoweringErrorEnumLoweringError

Julia

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

Raised when enum lowering (esm-spec §9.3) fails, carrying the stable diagnostic code as a structured field rather than interpolated into the message — the same shape as ClosedFunctionError , and the same error TYPE the four other bindings raise here (EnumLoweringError in TypeScript, Python and Rust; DiagnosticError in Go). Julia raised ParseError from this pass until API_SPEC.md §8 item 15, which made a caller’s catch e; e isa ParseError the only portable way to handle a failure that is not a parse failure at all.

Codes: enum_op_malformed, unknown_enum, unknown_enum_symbol.

Source

TypeScript

class EnumLoweringError extends EsmDiagnosticError
new EnumLoweringError(code: string, message: string): EnumLoweringError

Error thrown by lowerEnums (and so by loading) when an enum op cannot be lowered. code is enum_op_malformed, unknown_enum or unknown_enum_symbol, as listed above; the message is [code] message.

Source

Python

class EnumLoweringError(EarthSciAstError, ValueError)
EnumLoweringError(code: str, message: str)

Raised when enum lowering (esm-spec §9.3) fails.

Carries the stable diagnostic code (unknown_enum / unknown_enum_symbol) as a structured attribute — like ClosedFunctionError — instead of interpolating it into the message text. Also subclasses ValueError, so except ValueError catches it.

Source

Rust

pub type EnumLoweringError = DiagnosticError;

Stable diagnostic codes raised by the enum-lowering pass. Mirrors the codes emitted by the TS / Python / Julia / Go bindings.

Source · Rust docs

Go

type EnumLoweringError struct {
	Code    string
	Message string
}

func (e *EnumLoweringError) DiagnosticCode() string

func (e *EnumLoweringError) Error() string

EnumLoweringError carries the spec-defined diagnostic codes for the load-time lowering pass:

  • unknown_enum — enum op names an undeclared enum.
  • unknown_enum_symbol — enum op names a symbol not declared under that enum.

Methods

func (e *EnumLoweringError) DiagnosticCode() string

DiagnosticCode returns the stable diagnostic code (DiagnosticError).

func (e *EnumLoweringError) Error() string

Source · Go docs