Skip to main content

worldinterface_host/
error.rs

1//! Error types for the Host.
2
3use worldinterface_contextstore::error::ContextStoreError;
4use worldinterface_core::id::FlowRunId;
5use worldinterface_flowspec::error::CompilationError;
6
7/// Errors from the Host.
8#[derive(Debug, thiserror::Error)]
9pub enum HostError {
10    /// Host configuration is invalid.
11    #[error("invalid configuration: {0}")]
12    InvalidConfig(String),
13
14    /// FlowSpec compilation failed (includes validation failures).
15    #[error("flow compilation failed: {0}")]
16    Compilation(#[from] CompilationError),
17
18    /// ActionQueue engine bootstrap failed.
19    #[error("engine bootstrap failed: {0}")]
20    Bootstrap(#[from] actionqueue_runtime::engine::BootstrapError),
21
22    /// ActionQueue engine error during operation.
23    #[error("engine error: {0}")]
24    Engine(#[from] actionqueue_runtime::engine::EngineError),
25
26    /// ContextStore error.
27    #[error("context store error: {0}")]
28    ContextStore(#[from] ContextStoreError),
29
30    /// FlowRun not found.
31    #[error("flow run not found: {0}")]
32    FlowRunNotFound(FlowRunId),
33
34    /// Connector not found in registry.
35    #[error("connector not found: {0}")]
36    ConnectorNotFound(String),
37
38    /// Flow execution failed.
39    #[error("flow {flow_run_id} failed: {error}")]
40    FlowFailed { flow_run_id: FlowRunId, error: String },
41
42    /// Flow was canceled.
43    #[error("flow {0} was canceled")]
44    FlowCanceled(FlowRunId),
45
46    /// I/O error (creating directories, etc.)
47    #[error("I/O error: {0}")]
48    Io(#[from] std::io::Error),
49
50    /// Serialization/deserialization error.
51    #[error("serialization error: {0}")]
52    Serde(#[from] serde_json::Error),
53
54    /// UUID parse error (for coordinator map restoration).
55    #[error("UUID parse error: {0}")]
56    UuidParse(#[from] uuid::Error),
57
58    /// Internal error (should not happen — indicates a bug).
59    #[error("internal error: {0}")]
60    InternalError(String),
61}