algocline_app/pool/error.rs
1/// Errors produced by the process-pool IPC layer.
2///
3/// All variants are propagated to callers via `Result<T, PoolError>`.
4/// At the `AppService` boundary (Subtask 5/6) these are converted to
5/// `String` to satisfy the existing `EngineApi` wire contract.
6#[derive(Debug, thiserror::Error)]
7pub enum PoolError {
8 /// Unix-domain socket connection failed.
9 #[error("failed to connect to UDS socket: {0}")]
10 Connect(#[from] std::io::Error),
11
12 /// Socket write (or flush) failed after connection was established.
13 #[error("failed to write UDS socket: {0}")]
14 IoWrite(String),
15
16 /// Socket read failed after connection was established.
17 #[error("failed to read UDS socket: {0}")]
18 IoRead(String),
19
20 /// A response line from the worker could not be parsed as valid JSON.
21 #[error("failed to parse worker response: {0}")]
22 ResponseParse(String),
23
24 /// `registry.json` could not be parsed (corrupt or schema mismatch).
25 ///
26 /// Treating this as "empty registry" would silently kill live workers;
27 /// callers must propagate this error.
28 #[error("registry.json corrupted: {0}")]
29 RegistryCorrupted(String),
30
31 /// Spawning the worker subprocess failed.
32 #[error("worker spawn failed: {0}")]
33 Spawn(String),
34
35 /// Version handshake with the worker was rejected or timed out.
36 #[error("worker handshake failed: {0}")]
37 Handshake(String),
38
39 /// The requested session ID is not present in the pool.
40 #[error("session not found in pool: {0}")]
41 SessionNotFound(String),
42
43 /// The worker was built with a different crate version.
44 #[error("version mismatch: client={client}, server={server}")]
45 VersionMismatch { client: String, server: String },
46}