Skip to main content

rings_rpc/
error.rs

1/// A wrap `Result` contains custom errors.
2pub type Result<T> = std::result::Result<T, Error>;
3
4/// Errors enum mapping global custom errors.
5#[derive(Debug, thiserror::Error)]
6#[non_exhaustive]
7pub enum Error {
8    /// The incoming method name is not part of the Rings JSON-RPC surface.
9    #[error("Invalid method.")]
10    InvalidMethod,
11    /// The JSON-RPC transport returned a method-level error.
12    #[error("Rpc error: {0}")]
13    RpcError(crate::jsonrpc::RpcError),
14    /// The signed request metadata failed verification.
15    #[error("Invalid signature.")]
16    InvalidSignature,
17    /// The request headers are missing required values or contain invalid values.
18    #[error("Invalid headers.")]
19    InvalidHeaders,
20}