1use crate::{HostId, RequestError, TopologyError, TopologyRevision};
2
3pub type FleetResult<T> = Result<T, FleetError>;
5
6#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
8#[non_exhaustive]
9pub enum FleetError {
10 #[error(transparent)]
12 Topology(#[from] TopologyError),
13 #[error(transparent)]
15 Request(#[from] RequestError),
16 #[error("fleet target not found: {0}")]
18 TargetNotFound(HostId),
19 #[error("stale topology for {host}: expected {expected}, current revision is {actual}")]
21 StaleTopology {
22 host: HostId,
24 expected: TopologyRevision,
26 actual: TopologyRevision,
28 },
29 #[error("fleet operation cancelled")]
31 Cancelled,
32 #[error("fleet operation deadline exceeded")]
34 DeadlineExceeded,
35 #[error("connection to {host} failed: {message}")]
37 Connection {
38 host: HostId,
40 message: String,
42 },
43 #[error("command on {host} failed: {message}")]
45 Command {
46 host: HostId,
48 message: String,
50 },
51 #[error("remote command on {host} detached after {reason}; it may still be running")]
53 RemoteCommandDetached {
54 host: HostId,
56 reason: &'static str,
58 },
59 #[error("transfer from {source_host} to {destination_host} failed: {message}")]
61 Transfer {
62 source_host: HostId,
64 destination_host: HostId,
66 message: String,
68 },
69 #[error("invalid transfer lifecycle: {0}")]
71 TransferLifecycle(String),
72 #[error("fleet event sink failed: {0}")]
74 EventSink(String),
75}
76
77#[cfg(test)]
78#[path = "error_tests.rs"]
79mod tests;