Skip to main content

liminal_server/
error.rs

1use std::net::SocketAddr;
2
3/// Error taxonomy for standalone liminal server deployment failures.
4#[derive(Debug, thiserror::Error)]
5pub enum ServerError {
6    /// The configuration file could not be read or parsed.
7    #[error("configuration load failed: {message}")]
8    ConfigLoad { message: String },
9
10    /// The configuration file was read but failed semantic validation.
11    #[error("configuration validation failed: {message}")]
12    ConfigValidation { message: String },
13
14    /// The server could not bind its configured listener address.
15    #[error("listener bind failed for {address}: {source}")]
16    ListenerBind {
17        /// Address the server attempted to bind.
18        address: SocketAddr,
19        /// Underlying operating-system bind failure.
20        #[source]
21        source: std::io::Error,
22    },
23
24    /// The server listener failed while accepting an inbound connection.
25    #[error("listener accept failed: {message}")]
26    ListenerAccept { message: String },
27
28    /// A server→client push reply slot was dropped before a correlated reply
29    /// arrived — the connection closed (the prompt worker-death signal). Distinct
30    /// from [`Self::PushReplyTimeout`] so consumers can tell a worker that DIED
31    /// (fast failover) from one that is merely SLOW, by type rather than message.
32    #[error(
33        "push correlation {correlation_id} did not complete: the connection closed before sending a correlated push reply"
34    )]
35    PushReplyDisconnected {
36        /// Correlation id of the push whose reply will never arrive.
37        correlation_id: u64,
38    },
39
40    /// A server→client push reply did not arrive within the awaiter's timeout —
41    /// the worker is still connected but did not reply in time.
42    #[error(
43        "push correlation {correlation_id} did not complete: no correlated push reply arrived within the timeout"
44    )]
45    PushReplyTimeout {
46        /// Correlation id of the push that timed out.
47        correlation_id: u64,
48    },
49
50    /// The server could not join the configured beamr distribution cluster.
51    #[error("cluster join failed: {message}")]
52    ClusterJoin { message: String },
53
54    /// Cluster state propagation through beamr distribution failed.
55    #[error("cluster sync failed: {message}")]
56    ClusterSync { message: String },
57
58    /// Graceful shutdown did not drain within the configured timeout.
59    #[error("shutdown timed out: {message}")]
60    ShutdownTimeout { message: String },
61
62    /// Durable state could not be flushed during graceful shutdown.
63    #[error("shutdown flush failed: {message}")]
64    ShutdownFlush { message: String },
65
66    /// The health endpoint failed to start or serve requests.
67    #[error("health endpoint failed: {message}")]
68    HealthEndpoint { message: String },
69}