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.

flatten_error

Stable error · Flatten

Tier: stable · Kind: error · Topic: Flatten

JuliaTypeScriptPythonRustGo
FlattenErrorFlattenErrorFlattenErrorFlattenErrornot exported

Julia

abstract type FlattenError <: EarthSciASTError
FlattenError <: EarthSciASTError

Supertype of the errors flatten raises about the document it flattens, as in Python, TypeScript and Rust. Each subtype leads with code::String, the diagnostic code a caller branches on (for a type whose message begins with a code, "<code>: …", that code). Its message is composed from its fields by _flatten_message, and it prints through the package’s one showerror. Each keeps its positional constructor without the code, which it fills in.

A refusal the other bindings do not name with a type of its own is a FlattenRefusal (unexported): catch it as FlattenError and read its code with error_code .

Source

TypeScript

class FlattenError extends EsmDiagnosticError
new FlattenError(message: string, code?: string, details?: Record<string, unknown>): FlattenError

Base class for every error flatten raises. Mirrors Rust’s FlattenError and Python’s FlattenError for cross-language error-name parity.

Source

Python

class FlattenError(EarthSciAstError)

Base class for errors raised during flatten().

Source

Rust

pub enum FlattenError {
    ConflictingDerivative { species: Vec<String>, message: String },
    DimensionPromotion { message: String },
    UnmappedDomain { systems: Vec<String>, candidate_targets: Vec<String> },
    UnsupportedMapping { mapping_type: String, reason: String },
    UnloweredOperator { op: String },
    DomainUnitMismatch { variable: String, source_units: String, target_units: String },
    DomainExtentMismatch { variable: String },
    SliceOutOfDomain { coordinate: String, value: String },
    CyclicPromotion { variables: Vec<String> },
    VariableMapFactorWithExpression { from: String, to: String },
    VariableMapExpressionMissingFrom { from: String, to: String },
    VariableMapUnresolvedEndpoint { from: String, to: String, side: String, endpoint: String },
    VariableMapShapeConflict { from: String, to: String, source_shape: Vec<String>, target_shape: Vec<String>, took_shape: bool },
    Reaction(DeriveError),
    CouplingImport(DiagnosticError),
    MalformedConnectorEquation { systems: String, side: String },
    CoupleMultiplicativeNoTendency { target: String },
    OperatorComposeNoMerge { a: String, b: String, authored: usize, unmatched: String },
    OperatorComposeRequireMatchUnmatched { a: String, b: String, merged: usize, authored: usize, unmatched: String },
    OperatorComposeAmbiguousBareName { a: String, b: String, b_dep: String, target: String },
    RecordsPerSample(DiagnosticError),
    Migration(DiagnosticError),
    Empty,
}

impl FlattenError { pub fn code(&self) -> Option<&'static str> }

Errors raised by flatten and flatten_model during spec-compliant coupled-system flattening.

Variant names are deliberately cross-language-compatible so Julia, Python, and Rust agents can report the same failure using the same error name.

Source · Rust docs

Go

Go does not export this error.