expression_template_error
Stable error · Load-time lowering and templates
Tier: stable · Kind: error · Topic: Load-time lowering and templates
| Julia | TypeScript | Python | Rust | Go |
|---|---|---|---|---|
ExpressionTemplateError | ExpressionTemplateError | ExpressionTemplateError | not exported | ExpressionTemplateError |
Julia
struct ExpressionTemplateError <: EarthSciAST._LoadDiagnostic
ExpressionTemplateError(code::String, message::String, path::String, file::String, details::Dict{String, Any})
ExpressionTemplateError(code, message, path, file, details)
ExpressionTemplateError(code::AbstractString, message::AbstractString; path, file, details)
ExpressionTemplateError <: EarthSciASTError
A load-time pass refused the document: expression-template expansion
(esm-spec §9.6), template-library imports (§9.7), coupling-library imports
(§10.9–§10.11), the §4.7 mount checks (mounts.jl), the version gates, and the
solver and data-source location checks. Its code is drawn from
ERROR_CODES
; _KNOWN_DIAGNOSTIC_CODES lists the codes it is
raised with. Codes and their messages are conformance-relevant, so a new raise
site uses a registered code, and a new code is added to ERROR_CODES and
coordinated across the bindings with its first raise site. Fields: the common
ones of _LoadDiagnostic.
ExpressionTemplateError(code, message; path = "", file = "", details = Dict())
TypeScript
class ExpressionTemplateError extends EsmDiagnosticError
new ExpressionTemplateError(code: string, message: string): EsmMachineryError
Deprecated. Alias of EsmMachineryError
— the SAME class object, so
instanceof ExpressionTemplateError and instanceof EsmMachineryError are
identical. Prefer EsmMachineryError
, which names the class’s role as
the shared load-time template/coupling/import/ref machinery diagnostic.
Shared load-time diagnostic for the §9.x machinery: expression-template
lowering (§9.6), template-library imports (§9.7), coupling-library imports
(§10.10), subsystem-ref loading, and the §9.6.4 expanded-form validators all
raise it as their common coded-diagnostic class — validate maps it (by
instanceof) to the expression_template_error load-error kind. A subclass
of EsmDiagnosticError
: code is the specific diagnostic and the
message text is [code] message.
Python
class ExpressionTemplateError(EarthSciAstError)
ExpressionTemplateError(code: str, message: str)
Raised when expression-template expansion fails.
The code attribute carries one of the stable diagnostic codes:
apply_expression_template_unknown_template,
apply_expression_template_bindings_mismatch,
apply_expression_template_recursive_body,
apply_expression_template_invalid_declaration,
apply_expression_template_version_too_old,
rewrite_rule_nonterminating,
template_constraint_unknown_index_set (§9.6.1 where scoping),
makearray_region_inverted (§4.3.2 empty/inverted bounds),
or one of the esm-spec §9.7 template-library / metaparameter codes
(§9.6.6, raised from earthsci_ast.template_imports and
earthsci_ast.parse):
template_import_version_too_old, template_import_unresolved,
template_import_not_library, template_library_illegal_payload,
subsystem_ref_is_template_library,
template_import_cycle, template_import_name_conflict,
template_import_unknown_name, template_import_index_set_conflict,
template_body_expansion_too_deep, metaparameter_unbound,
metaparameter_type_error, metaparameter_name_conflict,
or one of the esm-spec §9.7.7 import-renaming codes (raised from
earthsci_ast.template_imports):
template_import_rename_unknown_name,
template_import_rebind_unknown_name,
template_import_rename_collision, template_import_rename_invalid,
or one of the esm-spec §10.9–§10.11 coupling-library / coupling_import
role-binding codes (raised from earthsci_ast.coupling_imports, with
subsystem_ref_is_coupling_library / template_import_is_coupling_library
raised from earthsci_ast.parse / earthsci_ast.template_imports):
coupling_import_unresolved, coupling_import_not_library,
coupling_library_illegal_payload, coupling_library_nested_import,
coupling_edge_unknown_role, coupling_role_unused,
coupling_import_unknown_role, coupling_import_role_unbound,
coupling_import_bind_not_a_component,
subsystem_ref_is_coupling_library,
template_import_is_coupling_library.
The code constants themselves are defined in
earthsci_ast.error_handling; their string values are part of the
cross-binding contract and must never change.
Rust
Rust does not export this error.
Go
type ExpressionTemplateError struct {
Code string
Message string
// Path is an RFC 6901 JSON Pointer to the document node that carries the
// defect, when one can be attributed. It is populated for LOAD-phase
// rejections that a conformance producer must surface as a structured
// (code, path) structural finding — e.g. a §4.7 subsystem ref that does not
// resolve (`/models/<M>/subsystems/<name>`). Most template/metaparameter
// errors leave it empty; a caller that needs a pointer sets it via
// withETPath as the error unwinds past the frame that knows the location.
Path string
}
func (e *ExpressionTemplateError) DiagnosticCode() string
func (e *ExpressionTemplateError) DiagnosticPath() string
func (e *ExpressionTemplateError) Error() string
ExpressionTemplateError is the error type raised by the expression-template expansion pass. The Code field carries one of the stable diagnostic codes:
- operator_unknown_definition
- operator_bindings_mismatch
- operator_recursive_body
- operator_invalid_definition
- operator_version_too_old
- rewrite_rule_nonterminating
or one of the esm-spec §9.7 template-library / metaparameter codes (§9.6.6, raised from template_imports.go and subsystem_ref.go):
- operator_import_version_too_old
- operator_import_unresolved
- operator_import_not_library
- operator_library_illegal_payload
- subsystem_ref_is_operator_library
- operator_import_cycle
- operator_import_name_conflict
- operator_import_unknown_name
- operator_import_index_set_conflict
- operator_body_expansion_too_deep
- metaparameter_unbound
- metaparameter_type_error
- metaparameter_name_conflict
or one of the esm-spec §10.11 coupling-library / coupling_import codes (raised from coupling_imports.go, subsystem_ref.go, template_imports.go):
- coupling_import_unresolved
- coupling_import_not_library
- subsystem_ref_is_coupling_library
- operator_import_is_coupling_library
- coupling_library_illegal_payload
- coupling_library_nested_import
- coupling_edge_unknown_role
- coupling_role_unused
- coupling_import_unknown_role
- coupling_import_role_unbound
- coupling_import_bind_not_a_component
Methods
func (e *ExpressionTemplateError) DiagnosticCode() string
DiagnosticCode returns the stable diagnostic code (DiagnosticError).
func (e *ExpressionTemplateError) DiagnosticPath() string
DiagnosticPath returns the JSON Pointer the error is attributed to, or "" if none was set.
func (e *ExpressionTemplateError) Error() string