Project

EarthSciAST

The EarthSciML Abstract Syntax Tree format: schema, operators, coupling, and five language bindings.

Contents

This is the documentation for the older version v0.16.0. For the latest release, see v0.17.0.

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 <: EarthSciAST._LoadDiagnostic
EnumLoweringError(code::String, message::String, path::String, file::String, details::Dict{String, Any})
EnumLoweringError(code, message, path, file, details)
EnumLoweringError(code::AbstractString, message::AbstractString; path, file, details)
EnumLoweringError <: EarthSciASTError

Raised when enum lowering (esm-spec §9.3) fails, the same error type the other bindings raise here (EnumLoweringError in TypeScript, Python and Rust; DiagnosticError in Go; API_SPEC.md §8 item 15). Codes: enum_duplicate_value, enum_op_malformed, unknown_enum, unknown_enum_symbol. Fields: the common ones of _LoadDiagnostic.

EnumLoweringError(code, message; path = "", file = "", details = Dict())

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 / enum_duplicate_value) as a structured attribute 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.
  • enum_duplicate_value — two symbols of one enum map to the same integer.

Methods

func (e *EnumLoweringError) DiagnosticCode() string

DiagnosticCode returns the stable diagnostic code (DiagnosticError).

func (e *EnumLoweringError) Error() string

Source · Go docs