Skip to main content

KernelError

Enum KernelError 

Source
pub enum KernelError {
    CategoricalAxis(InputAxis),
    AxisAbsent(InputAxis),
    TypeMismatch(InputAxis),
    AxisUnsupportedForRequest {
        axis: InputAxis,
        reason: &'static str,
    },
    Solve {
        code: SolveErrorCodeV1,
        message: String,
    },
    Observation(TrajectoryObservationError),
    NonFinite(InputAxis),
    StepOutOfDomain {
        axis: InputAxis,
        attempted: f64,
    },
    DuplicateAxis(InputAxis),
    InvalidDomain {
        axis: InputAxis,
        reason: &'static str,
    },
}

Variants§

§

CategoricalAxis(InputAxis)

Reserved for a later (differentiation) task: an axis whose axis_meta(axis).kind is AxisKind::Categorical was asked to be treated as continuous. Not constructed by read_axis/with_axis themselves, which accept categorical axes just like any other.

§

AxisAbsent(InputAxis)

The axis is structurally unavailable on THIS request’s resolved shape – currently only the three wind axes when the resolved wind is ResolvedWindV1::Segmented, mirroring read_axis returning None for the identical condition (see the module doc).

§

TypeMismatch(InputAxis)

The AxisValue variant supplied to with_axis does not match what axis expects (e.g. a Scalar for DragModel, or a Flag for any continuous axis).

§

AxisUnsupportedForRequest

The axis is well-formed and present, but this particular request’s OTHER inputs make perturbing it physically wrong rather than merely unrepresentable – see the guards documented on with_axis.

Fields

§reason: &'static str
§

Solve

The rebuilt request failed to resolve or solve. Not constructed here – with_axis only builds the request, it does not solve it; crate::perturbation::evaluate (0.33.0 decision-support Task 6) is the constructor, uniformly for every stage that can fail (solve_v1::prepare_request, solve_v1::build_zeroed_solver, and TrajectorySolver::solve).

code is carried alongside message (review fix I4(a), derive.rs) specifically so a caller – most notably central_difference’s one-sided fallback – can tell a domain rejection (SolveErrorCodeV1::InvalidValue, produced by require_range/ require_non_negative/require_positive in solve_v1.rs) apart from a genuine solver failure (SolveFailed, ResourceLimit, InternalError) or a malformed-request bug (ConflictingFields, MissingField, UnknownField, …) that merely happened to be triggered by one particular perturbed value. Collapsing this to a String (the previous shape) made that distinction unrecoverable except by parsing the message.

Fields

§message: String
§

Observation(TrajectoryObservationError)

Post-solve observation extraction failed – most notably a requested range outside the computed trajectory. Not constructed here for the same reason as Solve; crate::perturbation::evaluate constructs it directly from a crate::trajectory_observation::TrajectoryObservationError, preserved WHOLE (not collapsed to its Display string) for the same reason as Solve’s code above: only TrajectoryObservationError::OutOfRange is a domain rejection eligible for central_difference’s one-sided fallback – NonMonotonicTrajectory, NonFiniteState, SampleLimitExceeded, AllocationFailed, and the rest are genuine bugs that must propagate, not be silently reinterpreted as “this side left the domain.”

§

NonFinite(InputAxis)

A Scalar value supplied to with_axis was not finite (NaN or infinite).

§

StepOutOfDomain

Both perturbed sides of a central difference failed to produce a usable observation – neither x + attempted nor x - attempted evaluates – so not even a one-sided difference can be built (central_difference’s domain fallback, src/perturbation/derive.rs). Distinct from a derivative of zero: this means “undifferentiable with this step,” never “no effect.”

Fields

§attempted: f64
§

DuplicateAxis(InputAxis)

The same axis was declared more than once in a caller-supplied source list. Not constructed by read_axis/with_axis/central_difference (none of which see more than one axis at a time) – crate::error_budget::error_budget (0.33.0 decision-support Task 10, MBA-1347 review) constructs this from its own up-front validation, because two entries for the same axis would double-count that axis’s variance and corrupt its leave-one-out counterfactual (removing “the” declaration for that axis is ambiguous when there are two). KernelError had not shipped on any released version when this variant was added, so there is no compatibility concern in extending it.

§

InvalidDomain

The domain supplied to crate::tolerance::tolerance_envelope for one axis is missing, or does not have the shape a one-variable bisection needs: both bounds finite, the lower bound strictly less than the upper, and the axis’s own current value strictly between them. A domain where the current value sits AT (not strictly inside) one edge would make that search direction a zero-width probe – bisect_axis would report Ok(None) for it (the two identical endpoints trivially agree), and that None would be indistinguishable from a genuine “stays inside throughout” result even though nothing beyond the current value was ever actually searched. 0.33.0 decision-support Task 12 (MBA-1350): never constructed by with_axis/evaluate/bisect_axis themselves – tolerance_envelope validates its own domain argument up front, before any solve, the same way crate::error_budget::error_budget validates its ranges_m/sources arguments.

Fields

§reason: &'static str

Implementations§

Source§

impl KernelError

Source

pub fn is_domain_rejection(&self) -> bool

True when this error means the specific perturbed VALUE fell outside the axis’s physical domain – an InvalidValue solve rejection (from require_range/require_non_negative/ require_positive in solve_v1.rs), or an OutOfRange observation query (a requested range that fell outside a trajectory shrunk by the perturbation) – as opposed to a genuine solver or trajectory failure that merely happened to be triggered by one particular perturbed value.

This is the ONLY thing crate::perturbation::central_difference’s one-sided fallback (derive.rs) may gate on. Review fix I4(a): an earlier revision gated on Err(_) (any failure at all on one side), which silently reinterpreted genuine bugs – a non-convergent zero search, a non-finite trajectory state, a sample-limit overrun – as if they were domain boundaries, answering with a fabricated derivative instead of reporting the real failure.

Trait Implementations§

Source§

impl Clone for KernelError

Source§

fn clone(&self) -> KernelError

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for KernelError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for KernelError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for KernelError

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl PartialEq for KernelError

Source§

fn eq(&self, other: &KernelError) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for KernelError

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,

Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.