Skip to main content

muse_codes/
error.rs

1//! Error types for the muse-codes SDK.
2
3use thiserror::Error;
4
5#[derive(Error, Debug)]
6pub enum Error {
7    #[error("JSON serialization error: {0}")]
8    Json(#[from] serde_json::Error),
9
10    #[error("IO error: {0}")]
11    Io(#[from] std::io::Error),
12
13    #[error("Protocol error: {0}")]
14    Protocol(String),
15
16    #[error("Binary not found: '{name}' is not on PATH. Is Muse Code installed?")]
17    BinaryNotFound { name: String },
18
19    #[error("muse exec exited (code {code:?}) before the run reached a terminal state")]
20    ExitedEarly { code: Option<i32> },
21}
22
23pub type Result<T> = std::result::Result<T, Error>;