Skip to main content

steer_core/
error.rs

1use steer_workspace::WorkspaceError;
2use thiserror::Error;
3
4use crate::{api::ApiError, auth::AuthError, tools::ToolError};
5
6pub type Result<T> = std::result::Result<T, Error>;
7
8#[derive(Debug, Error)]
9pub enum Error {
10    #[error(transparent)]
11    Api(#[from] ApiError),
12    #[error(transparent)]
13    Auth(#[from] AuthError),
14    #[error(transparent)]
15    Workspace(#[from] WorkspaceError),
16    #[error(transparent)]
17    Tool(#[from] ToolError),
18    #[error("I/O error: {0}")]
19    Io(#[from] std::io::Error),
20    #[error("Configuration error: {0}")]
21    Configuration(String),
22    #[error("Invalid operation: {0}")]
23    InvalidOperation(String),
24    #[error("Not found: {0}")]
25    NotFound(String),
26    #[error("Cancelled")]
27    Cancelled,
28    #[error("Ignore error: {0}")]
29    Ignore(#[from] ignore::Error),
30    #[error("gRPC transport error: {0}")]
31    Transport(String),
32    #[error("gRPC status error: {0}")]
33    Status(String),
34    #[error("Bash command error: {0}")]
35    BashCommandError(String),
36}
37
38impl From<steer_tools::ToolError> for Error {
39    fn from(err: steer_tools::ToolError) -> Self {
40        Error::Tool(err.into())
41    }
42}