1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// =============================================================================
// Copyright (c) 2025 - 2026 Haixing Hu.
//
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0.
// =============================================================================
//! Execution error kinds.
use std::fmt::Display;
use std::fmt::Formatter;
use std::fmt::Result;
/// A failure in the validation execution infrastructure.
///
/// # Examples
///
/// ```
/// use qubit_validator::ExecutionErrorKind;
///
/// let kind = ExecutionErrorKind::InputTypeMismatch;
/// assert_eq!(kind.to_string(), "input type mismatch");
/// ```
#[must_use]
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
#[non_exhaustive]
pub enum ExecutionErrorKind {
/// The supplied input has the wrong erased type.
InputTypeMismatch,
/// The validation selection contains no matching validation path.
InvalidSelection,
/// A dependency has the wrong erased type.
DependencyTypeMismatch,
/// A required dependency value is absent.
MissingRequiredDependencyValue,
/// A named dependency value is supplied more than once.
DuplicateDependencyBinding,
/// A named dependency does not exist in the selected signature.
UnknownDependencyBinding,
/// A declared dependency value was not supplied by name.
MissingDependencyBinding,
/// A property could not be read.
PropertyReadFailed,
/// Traversal exceeded an execution budget.
TraversalLimit,
/// A prepared adapter returned an invalid protocol result.
AdapterContractViolation,
/// An external operation failed.
ExternalFailure,
}
impl Display for ExecutionErrorKind {
/// Formats the stable human-readable error category.
///
/// # Parameters
///
/// - `formatter`: Receives the category's stable human-readable text.
fn fmt(&self, formatter: &mut Formatter<'_>) -> Result {
let name = match self {
Self::InputTypeMismatch => "input type mismatch",
Self::InvalidSelection => "invalid validation selection",
Self::DependencyTypeMismatch => "dependency type mismatch",
Self::MissingRequiredDependencyValue => "missing required dependency value",
Self::DuplicateDependencyBinding => "duplicate dependency binding",
Self::UnknownDependencyBinding => "unknown dependency binding",
Self::MissingDependencyBinding => "missing dependency binding",
Self::PropertyReadFailed => "property read failed",
Self::TraversalLimit => "traversal limit exceeded",
Self::AdapterContractViolation => "adapter contract violation",
Self::ExternalFailure => "external failure",
};
formatter.write_str(name)
}
}