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