1use thiserror::Error;
7
8#[derive(Debug, Error)]
10pub enum ConfigError {
11 #[error("no agent-procs.yaml found")]
12 NotFound,
13
14 #[error("cannot get cwd: {0}")]
15 Cwd(#[source] std::io::Error),
16
17 #[error("cannot read config: {0}")]
18 Read(#[source] std::io::Error),
19
20 #[error("invalid config: {0}")]
21 Parse(#[source] serde_yaml::Error),
22
23 #[error("dependency cycle detected")]
24 CycleDetected,
25
26 #[error("unknown dependency: {from} depends on {to}")]
27 UnknownDep { from: String, to: String },
28}
29
30#[derive(Debug, Error)]
32pub enum ClientError {
33 #[error("no daemon running for this session")]
34 NoDaemon,
35
36 #[error("failed to spawn daemon: {0}")]
37 SpawnFailed(#[source] std::io::Error),
38
39 #[error("failed to connect to daemon: {0}")]
40 ConnectionFailed(#[source] std::io::Error),
41
42 #[error("serialize error: {0}")]
43 Serialize(#[source] serde_json::Error),
44
45 #[error("write error: {0}")]
46 Write(#[source] std::io::Error),
47
48 #[error("flush error: {0}")]
49 Flush(#[source] std::io::Error),
50
51 #[error("read error: {0}")]
52 Read(#[source] std::io::Error),
53
54 #[error("parse error: {0}")]
55 ParseResponse(#[source] serde_json::Error),
56}
57
58#[derive(Debug, Error)]
60pub enum ProxyError {
61 #[error("requested proxy port {port} is not available: {source}")]
62 PortUnavailable { port: u16, source: std::io::Error },
63
64 #[error("no free proxy port available in range {min}-{max}")]
65 NoFreePort { min: u16, max: u16 },
66
67 #[error("no free port available in range {min}-{max} (started at {start})")]
68 NoFreeAutoPort { min: u16, max: u16, start: u16 },
69}