1use thiserror::Error;
4
5#[derive(Error, Debug)]
7pub enum Error {
8 #[error("connection failed: {0}")]
9 Connection(String),
10
11 #[error("transport error: {0}")]
12 Transport(String),
13
14 #[error("protocol error: {0}")]
15 Protocol(String),
16
17 #[error("tool not found: {0}")]
18 ToolNotFound(String),
19
20 #[error("tool call failed: {0}")]
21 ToolCallFailed(String),
22
23 #[error("resource not found: {0}")]
24 ResourceNotFound(String),
25
26 #[error("server error: {0}")]
27 Server(String),
28
29 #[error("config error: {0}")]
30 Config(String),
31
32 #[error("crypto error: {0}")]
33 Crypto(String),
34
35 #[error("identity error: {0}")]
36 Identity(String),
37
38 #[error("consensus error: {0}")]
39 Consensus(String),
40
41 #[error("io error: {0}")]
42 Io(#[from] std::io::Error),
43
44 #[error("capnp error: {0}")]
45 Capnp(#[from] capnp::Error),
46
47 #[error("json error: {0}")]
48 Json(#[from] serde_json::Error),
49
50 #[error("url error: {0}")]
51 Url(#[from] url::ParseError),
52}
53
54pub type Result<T> = std::result::Result<T, Error>;