Skip to main content

muster/
error.rs

1use thiserror::Error;
2
3use crate::{
4    adapter::hooks::HookError,
5    domain::{config::ConfigError, pty::PtyError},
6};
7
8/// Top-level error type for muster.
9///
10/// Domain and adapter modules define their own error enums; this aggregates
11/// them transparently so each error's `Display` speaks for itself.
12#[derive(Debug, Error)]
13pub enum MusterError {
14    /// An I/O failure while driving the terminal or a child process.
15    #[error("i/o error: {0}")]
16    Io(#[from] std::io::Error),
17    /// A workspace configuration failure.
18    #[error(transparent)]
19    Config(#[from] ConfigError),
20    /// A PTY / process-spawning failure.
21    #[error(transparent)]
22    Pty(#[from] PtyError),
23    /// A provider lifecycle integration failure.
24    #[error(transparent)]
25    Hook(#[from] HookError),
26}
27
28/// Crate-wide result alias.
29pub type Result<T> = std::result::Result<T, MusterError>;