Skip to main content

roam_types/
roam_error.rs

1use facet::Facet;
2
3// r[rpc.fallible.roam-error]
4/// Protocol-level error wrapper distinguishing application errors from roam infrastructure errors.
5///
6/// On the caller side, all return types are wrapped as `Result<T, RoamError<E>>`:
7///   * Infallible `fn foo() -> T` becomes `Result<T, RoamError>`
8///   * Fallible `fn foo() -> Result<T, E>` becomes `Result<T, RoamError<E>>`
9#[derive(Debug, Clone, Facet)]
10#[repr(u8)]
11pub enum RoamError<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,
20
21    /// The call was cancelled before completion.
22    Cancelled,
23}