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
impl ExecutionError
Sourcepub fn new(kind: ExecutionErrorKind) -> Self
pub fn new(kind: ExecutionErrorKind) -> Self
Sourcepub const fn kind(&self) -> ExecutionErrorKind
pub const fn kind(&self) -> ExecutionErrorKind
Sourcepub const fn rule_id(&self) -> Option<ValidatorId>
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.
Sourcepub const fn dependency(&self) -> Option<&'static str>
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.
Sourcepub const fn path(&self) -> &ValidationPath
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.
Sourcepub fn trusted_source(&self) -> Option<&(dyn Error + Send + Sync + 'static)>
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.
Sourcepub const fn with_rule(self, rule_id: ValidatorId) -> Self
pub const fn with_rule(self, rule_id: ValidatorId) -> Self
Sourcepub const fn with_dependency(self, dependency: &'static str) -> Self
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.
Sourcepub fn with_trusted_source<E>(self, source: E) -> Self
pub fn with_trusted_source<E>(self, source: E) -> Self
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.
§Parameters
source: Owned, thread-safe source error retained for this failure.
§Returns
This error with the trusted cause attached.
Sourcepub fn with_path(self, path: ValidationPath) -> Self
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
impl Debug for ExecutionError
Source§impl Display for ExecutionError
impl Display for ExecutionError
Source§impl Error for ExecutionError
impl Error for ExecutionError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()