enum_lowering_error
Stable error · Load-time lowering and templates
Tier: stable · Kind: error · Topic: Load-time lowering and templates
| Julia | TypeScript | Python | Rust | Go |
|---|---|---|---|---|
EnumLoweringError | EnumLoweringError | EnumLoweringError | EnumLoweringError | EnumLoweringError |
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.
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.
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.
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.
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 —
enumop names an undeclared enum. - unknown_enum_symbol —
enumop 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