switchyard/types/
errors.rs

1//! Error types used across Switchyard.
2use thiserror::Error;
3
4/// High-level error categories for type-level operations and adapters.
5#[derive(Debug, Copy, Clone, Error)]
6pub enum ErrorKind {
7    #[error("invalid path")]
8    InvalidPath,
9    #[error("io error")]
10    Io,
11    #[error("policy violation")]
12    Policy,
13}
14
15/// Structured error with a kind and human message.
16#[derive(Debug, Error)]
17#[error("{kind:?}: {msg}")]
18pub struct Error {
19    pub kind: ErrorKind,
20    pub msg: String,
21}
22
23/// Convenient alias for results returning a `types::Error`.
24pub type Result<T> = std::result::Result<T, Error>;