Skip to main content

wifi_densepose_worldmodel/
error.rs

1//! Error types for the OccWorld world-model bridge (ADR-147).
2
3use thiserror::Error;
4
5/// All errors that can be returned by the OccWorld bridge.
6#[derive(Debug, Error)]
7pub enum WorldModelError {
8    /// Could not connect to the Unix-domain socket served by the Python
9    /// OccWorld inference process.
10    #[error("could not connect to OccWorld socket at `{path}`: {source}")]
11    SocketConnect {
12        /// The socket path that was attempted.
13        path: String,
14        /// The underlying I/O error.
15        source: std::io::Error,
16    },
17
18    /// A request or response exceeded the 30-second wall-clock deadline.
19    #[error("OccWorld inference timed out after {timeout_s}s")]
20    Timeout {
21        /// The configured timeout in seconds.
22        timeout_s: u64,
23    },
24
25    /// The JSON payload received from the server could not be decoded, or the
26    /// payload we tried to send could not be encoded.
27    #[error("JSON (de)serialisation error: {0}")]
28    SerdeJson(#[from] serde_json::Error),
29
30    /// The server sent a response that violates the newline-delimited JSON
31    /// protocol (e.g. an unexpected EOF before the newline delimiter, or an
32    /// oversized frame that exceeded the read buffer limit).
33    #[error("protocol error: {0}")]
34    Protocol(String),
35
36    /// The OccWorld inference server reported that GPU VRAM is unavailable
37    /// (out-of-memory condition on the device side).
38    #[error("OccWorld server reports VRAM unavailable: {0}")]
39    VramUnavailable(String),
40}