Diagnostics and outcomes
Public failures use a shared diagnostic taxonomy:
| Category | Meaning |
|---|---|
wrong_host_type |
host value has the wrong kind |
invalid_exact_conversion |
conversion would be lossy or ambiguous |
wrong_collection_shape_or_length |
nesting, dimensions, or paired lengths are invalid |
wrong_expression_kind |
a symbolic value is not the required structural kind |
context_mismatch |
objects have different owners |
stale_object |
a reset or free invalidated the handle |
invalid_option |
closed-vocabulary spelling is invalid |
mathematical_domain_error |
input is outside the operation's domain |
unsupported_or_declined_computation |
the operation could not produce a supported result |
indeterminate_proof |
a proposition was neither proved nor disproved |
resource_budget_exhaustion |
an explicit materialization or computation budget was reached |
internal_verification_failure |
an invariant or result certification failed |
Messages name the operation and parameter path, describe the received and expected values, and provide a hint when a reliable remediation exists. Parser diagnostics include a source excerpt and caret.
Python errors use the nearest built-in family while adding the attributes
category, operation, parameter_path, received, expected, and hint.
JavaScript facade errors derive from SymiError; specialized subclasses
distinguish type, context, domain, resource, and internal failures. Rust
returns ApiError, which implements std::error::Error and produces the same
structured diagnostic record.
Invalid input is never encoded as a mathematical undefined, empty list, or
None. Conversely, a declined computation is not automatically an exception:
operations whose mathematical contract permits an unevaluated result return
that expression, and algorithms with distinct outcome states use structured
solved, empty, positive_dimensional, and declined variants. A
three-valued logical None/null means unknown, not malformed input.
Example#
Failures carry a stable category, parameter path, and hint.
use symi::api::prelude::*;
fn main() {
let first = Session::new();
let second = Session::new();
let x = first.symbol("x");
if let Err(error) = second.differentiate(&x, "x") {
println!("{:?}", error.category());
println!("{:?}", error.diagnostic("differentiate"));
}
}Additional API#
api::serialized_parse_error#
api re_export
pub use crate::serialize::parse::ParseError as serialized_parse_error;Re-exports the serialized-object parse error type reported by object parsing.
ApiError#
Type
pub enum ApiErrorPublic native enumeration named api_error.
ApiError.AssumptionConflict#
api::ApiError variant
AssumptionConflict(String)Represents a rejected assumption mutation.
ApiError.AssumptionResourceExhausted#
api::ApiError variant
AssumptionResourceExhausted,Represents an assumption query or mutation beyond the bounded engine.
ApiError.ComputationDeclined#
api::ApiError variant
ComputationDeclined,Represents the computation_declined case.
ApiError.ContextMismatch#
api::ApiError variant
ContextMismatch,Represents the context_mismatch case.
ApiError.ExpressionRequired#
api::ApiError variant
ExpressionRequired,Represents the expression_required case.
ApiError.GenerationExhausted#
api::ApiError variant
GenerationExhausted,Represents the generation_exhausted case.
ApiError.GeometryError#
api::ApiError variant
GeometryError(GeometryError)Represents the geometry_error case.
ApiError.InconsistentConstraint#
api::ApiError variant
InconsistentConstraint,Represents the inconsistent_constraint case.
ApiError.IntegerRequired#
api::ApiError variant
IntegerRequired,Represents an operation that requires an exact integer expression.
ApiError.InvalidAssumption#
api::ApiError variant
InvalidAssumption,Represents an invalid assumption wrapper.
ApiError.InvalidConstraint#
api::ApiError variant
InvalidConstraint,Represents the invalid_constraint case.
ApiError.LatexParseError#
api::ApiError variant
LatexParseError(String)Represents input that the canonical LaTeX dialect could not parse.
ApiError.LogicalExpressionRequired#
api::ApiError variant
LogicalExpressionRequired,Represents the logical_expression_required case.
ApiError.MatrixError#
api::ApiError variant
MatrixError(MatrixError)Represents the MatrixError case.
ApiError.NumericDeclined#
api::ApiError variant
NumericDeclined(NumericDeclineError)Represents an explicit numeric request that produced no value, with its typed reason.
ApiError.NumericFunctionDeclined#
api::ApiError variant
NumericFunctionDeclined(NumericFunctionCompileDecline)Represents a numeric function that was not compiled, with what was refused and where.
ApiError.OperationCancelled#
api::ApiError variant
OperationCancelled,Represents an operation cancelled by its caller.
ApiError.ParallelismInitializationFailed#
api::ApiError variant
ParallelismInitializationFailed,Represents a parallel backend that failed to initialize.
ApiError.ParallelismNotCompiled#
api::ApiError variant
ParallelismNotCompiled,Represents a target without a compiled parallel backend.
ApiError.ParallelismRequiresAsyncInitialization#
api::ApiError variant
ParallelismRequiresAsyncInitialization,Represents atomic WebAssembly that must be initialized through its asynchronous adapter.
ApiError.ParseError#
api::ApiError variant
ParseError(ParseError)Represents the parse_error case.
ApiError.PartialDifferentialEquationProblem#
api::ApiError variant
PartialDifferentialEquationProblem(PartialDifferentialEquationProblemError)Represents a malformed scalar partial differential equation problem.
ApiError.PolynomialRequired#
api::ApiError variant
PolynomialRequired,Represents the polynomial_required case.
ApiError.SerializedParseError#
api::ApiError variant
SerializedParseError(String)Represents input that the canonical serialized-object grammar could not parse.
ApiError.StaleObject#
api::ApiError variant
StaleObject,Represents the stale_object case.
ApiError.SymbolRequired#
api::ApiError variant
SymbolRequired,Represents the symbol_required case.
ApiError.ZeroDenominator#
api::ApiError variant
ZeroDenominator,Represents the zero_denominator case.
ApiError.category#
api::ApiError method
pub fn category(&self) -> DiagnosticCategoryProvides the category operation on this native type.
ApiError.diagnostic#
api::ApiError method
pub fn diagnostic(&self, operation: &str) -> DiagnosticProvides the diagnostic operation on this native type.
Diagnostic#
api re_export
pub use crate::diagnostics::Diagnostic;Re-exports the canonical diagnostic record and its category vocabulary.
DiagnosticCategory#
api re_export
pub use crate::diagnostics::DiagnosticCategory;Re-exports the canonical diagnostic record and its category vocabulary.
GeometryError#
api re_export
pub use crate::geometry::GeometryError;Re-exports the exact-geometry error type carried by api_error.
MatrixError#
api re_export
pub use crate::matrix::MatrixError;Re-exports the matrix error type carried by api_error.
ParseError#
api re_export
pub use crate::interactive::parser::ParseError;Re-exports the interactive-parser error type carried by api_error.
VectorCalculusError#
api re_export
pub use crate::vector_calculus::VectorCalculusError;Re-exports the vector-calculus error type reported by vector-calculus operations.