Skip to main content

vox_types/
vox_error.rs

1use facet::Facet;
2
3// r[rpc.fallible.vox-error]
4/// Protocol-level error wrapper distinguishing application errors from vox infrastructure errors.
5///
6/// On the caller side, all return types are wrapped as `Result<T, VoxError<E>>`:
7///   * Infallible `fn foo() -> T` becomes `Result<T, VoxError>`
8///   * Fallible `fn foo() -> Result<T, E>` becomes `Result<T, VoxError<E>>`
9#[derive(Debug, Clone, Facet)]
10#[repr(u8)]
11pub enum VoxError<E = ::core::convert::Infallible> {
12    /// The handler ran and returned an application error.
13    User(E),
14
15    /// No handler recognized the method ID.
16    UnknownMethod,
17
18    /// The arguments could not be deserialized.
19    InvalidPayload(String),
20
21    /// The call was cancelled before completion (e.g. handler dropped without replying).
22    Cancelled,
23
24    /// The underlying connection closed while the call was in flight.
25    ConnectionClosed,
26
27    /// The session shut down while the call was in flight.
28    SessionShutdown,
29
30    /// The call could not be sent because the transport is dead.
31    SendFailed,
32
33    /// The runtime refused to guess after recovery.
34    Indeterminate,
35}