migration_error
Stable error · Versions and migration
Tier: stable · Kind: error · Topic: Versions and migration
| Julia | TypeScript | Python | Rust | Go |
|---|---|---|---|---|
MigrationError | MigrationError | MigrationError | MigrationError | MigrationError |
Julia
struct MigrationError <: EarthSciASTError
MigrationError(message::AbstractString; code, path)
MigrationError <: EarthSciASTError
Thrown when migrate
is asked for a version pair it does not support —
including every pair that crosses the 1.0.0 clean break — or for a 1.x document
that uses a construct esm 2.0.0 removed. code is the diagnostic code: empty
for an unsupported version pair, removed_op for a removed construct, whose
path it names.
TypeScript
class MigrationError extends EsmDiagnosticError
new MigrationError(message: string, code?: string): MigrationError
Error thrown when migration fails. code is removed_op when a 1.x document
is refused for using a construct esm 2.0.0 removed.
Python
class MigrationError(EarthSciAstError)
MigrationError(message: str, code: str | None = None)
Raised when an ESM document cannot be migrated to the requested version.
code is "removed_op" when migrate
refuses because the
document uses an operator or field esm 2.0.0 removed, and None otherwise.
Rust
pub struct MigrationError {
pub message: String,
pub from_version: String,
pub to_version: String,
}
Migration error that occurs when migration fails.
Carries the endpoint versions alongside the message so a caller can report
the pair without re-deriving it (Go’s MigrationError mirrors these fields).
Go
type MigrationError struct {
Message string
FromVersion string
ToVersion string
// Code is the diagnostic code of a refusal that has one: `removed_op` for a
// 1.x document that uses a construct esm 2.0.0 removed. Empty otherwise.
Code string
// contains filtered or unexported fields
}
func (e *MigrationError) Error() string
func (e *MigrationError) Unwrap() error
MigrationError is returned when a migration cannot be performed. It carries the endpoint versions alongside the message so a caller can report the pair without re-deriving it (mirrors the Rust binding’s MigrationError fields).
Methods
func (e *MigrationError) Error() string
func (e *MigrationError) Unwrap() error
Unwrap returns the diagnostic behind a coded refusal, so errors.As reaches it as a DiagnosticError.