Skip to main content

workflow_rpc/server/
error.rs

1//! [`enum@Error`] declarations for the [`server`](super) module
2
3use thiserror::Error;
4pub use workflow_websocket::server::Error as WebSocketError;
5
6#[derive(Debug, Error)]
7/// Errors produced by the RPC server.
8pub enum Error {
9    /// Error originating from the underlying WebSocket server.
10    #[error("WebSocket error: {0}")]
11    WebSocketError(#[from] workflow_websocket::server::error::Error),
12
13    /// Failure to send a message over an internal channel (receiver dropped).
14    #[error(transparent)]
15    ChannelSendError(#[from] tokio::sync::mpsc::error::SendError<tungstenite::Message>),
16
17    /// Underlying I/O error.
18    #[error(transparent)]
19    Io(#[from] std::io::Error),
20
21    /// Error originating from a spawned background task.
22    #[error(transparent)]
23    Task(#[from] workflow_task::TaskError),
24
25    /// General RPC error propagated from the crate's core error type.
26    #[error(transparent)]
27    RpcError(#[from] crate::error::Error),
28
29    /// JSON serialization or deserialization error.
30    #[error("SerdeJSON error: {0}")]
31    SerdeJSON(#[from] serde_json::Error),
32}