Skip to main content

ExecutionError

Struct ExecutionError 

Source
pub struct ExecutionError { /* private fields */ }
Expand description

An execution error with a safe public diagnostic surface.

Its public formatting and metadata never include raw validation input. An underlying cause can be retained for an explicitly trusted diagnostic consumer. The standard error chain deliberately does not expose that cause. The path is an opaque structured location: the caller or integrating layer defines its coordinate system. This type does not add path prefixes.

§Examples

use qubit_validator::{ExecutionError, ExecutionErrorKind};

let error = ExecutionError::new(ExecutionErrorKind::InputTypeMismatch);
assert_eq!(error.kind(), ExecutionErrorKind::InputTypeMismatch);
assert!(std::error::Error::source(&error).is_none());

Implementations§

Source§

impl ExecutionError

Source

pub fn new(kind: ExecutionErrorKind) -> Self

Creates an execution error at the root path.

§Parameters
  • kind: Stable category describing why execution failed.
§Returns

A new error without an associated rule, dependency, or source.

Source

pub const fn kind(&self) -> ExecutionErrorKind

Returns the error kind.

§Returns

The stable category describing this execution failure.

Source

pub const fn rule_id(&self) -> Option<ValidatorId>

Returns the associated rule identifier, if any.

§Returns

Returns Some when a rule has been attached, or None otherwise.

Source

pub const fn dependency(&self) -> Option<&'static str>

Returns the associated dependency slot name, if the error concerns one.

§Returns

Returns Some when a dependency has been attached, or None otherwise.

Source

pub const fn path(&self) -> &ValidationPath

Returns the structured error path unchanged.

The path remains structured and does not expose the raw input value. Its coordinate system is defined by the caller or integrating layer.

Source

pub fn trusted_source(&self) -> Option<&(dyn Error + Send + Sync + 'static)>

Returns the retained cause to a caller that is trusted to inspect it.

None means no owned cause was supplied. This accessor may reveal details unsuitable for ordinary logs or user-facing output.

§Returns

Some when a trusted cause was retained, or None otherwise.

Source

pub const fn with_rule(self, rule_id: ValidatorId) -> Self

Associates a rule identifier with this error.

§Parameters
  • rule_id: Identifier of the rule whose execution failed.
§Returns

This error with the rule identifier attached.

Source

pub const fn with_dependency(self, dependency: &'static str) -> Self

Associates a dependency slot name with this error.

When an integrating layer uses dependency metadata for location handling, the name must match a slot declared for the current rule.

§Parameters
  • dependency: Static name of the declared dependency slot involved in the failure.
§Returns

This error with the dependency name attached.

Source

pub fn with_trusted_source<E>(self, source: E) -> Self
where E: Error + Send + Sync + 'static,

Retains an owned cause for an explicitly trusted diagnostic consumer.

Ordinary formatting and std::error::Error::source never expose this value. Callers must avoid forwarding it to untrusted logs or clients.

§Type Parameters
  • E: The owned source error type retained behind the standard error trait object.
§Parameters
  • source: Owned, thread-safe source error retained for this failure.
§Returns

This error with the trusted cause attached.

Source

pub fn with_path(self, path: ValidationPath) -> Self

Replaces this error’s structured path.

This method does not concatenate or normalize paths. Integrations that distinguish ordinary rule errors from dependency errors must apply the appropriate coordinate convention at their own boundary.

§Parameters
  • path: Structured location, in the coordinate system selected by the caller, that does not render raw input keys.
§Returns

This error with the supplied path attached.

Trait Implementations§

Source§

impl Debug for ExecutionError

Source§

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

Formats structural metadata without exposing raw input or source text.

§Parameters
  • formatter: Destination formatter that receives the structural representation.
Source§

impl Display for ExecutionError

Source§

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

Formats a stable summary without exposing raw input or source text.

§Parameters
  • formatter: Destination formatter that receives the stable summary.
Source§

impl Error for ExecutionError

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

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> 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> 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.