steer_workspace/
error.rs

1use serde::{Deserialize, Serialize};
2use thiserror::Error;
3
4#[derive(Error, Debug, Clone, Serialize, Deserialize)]
5pub enum WorkspaceError {
6    #[error("I/O error: {0}")]
7    Io(String),
8
9    #[error("Tool execution failed: {0}")]
10    ToolExecution(String),
11
12    #[error("Transport error: {0}")]
13    Transport(String),
14
15    #[error("Status error: {0}")]
16    Status(String),
17
18    #[error("Not supported: {0}")]
19    NotSupported(String),
20
21    #[error("Invalid configuration: {0}")]
22    InvalidConfiguration(String),
23
24    #[error("Remote workspace error: {0}")]
25    Remote(String),
26}
27
28pub type Result<T> = std::result::Result<T, WorkspaceError>;
29
30impl From<tonic::transport::Error> for WorkspaceError {
31    fn from(err: tonic::transport::Error) -> Self {
32        WorkspaceError::Transport(err.to_string())
33    }
34}
35
36impl From<tonic::Status> for WorkspaceError {
37    fn from(err: tonic::Status) -> Self {
38        WorkspaceError::Status(err.to_string())
39    }
40}
41
42impl From<std::io::Error> for WorkspaceError {
43    fn from(err: std::io::Error) -> Self {
44        WorkspaceError::Io(err.to_string())
45    }
46}