zebra_rpc::server::error

Trait MapError

source
pub(crate) trait MapError<T>: Sized {
    // Required method
    fn map_error(
        self,
        code: impl Into<ErrorCode>,
    ) -> Result<T, ErrorObjectOwned>;

    // Provided method
    fn map_misc_error(self) -> Result<T, ErrorObjectOwned> { ... }
}
Expand description

A trait for mapping errors to [jsonrpsee_types::ErrorObjectOwned].

Required Methods§

source

fn map_error(self, code: impl Into<ErrorCode>) -> Result<T, ErrorObjectOwned>

Maps errors to [jsonrpsee_types::ErrorObjectOwned] with a specific error code.

Provided Methods§

source

fn map_misc_error(self) -> Result<T, ErrorObjectOwned>

Maps errors to [jsonrpsee_types::ErrorObjectOwned] with a LegacyCode::Misc error code.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<T, E> MapError<T> for Result<T, E>
where E: ToString,

source§

fn map_error(self, code: impl Into<ErrorCode>) -> Result<T, ErrorObjectOwned>

Implementors§