pub(crate) trait MapError<T>: Sized {
// Required methods
fn map_error(
self,
code: impl Into<ErrorCode>,
) -> Result<T, ErrorObjectOwned>;
fn map_error_with_prefix(
self,
code: impl Into<ErrorCode>,
msg_prefix: impl ToString,
) -> 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§
Sourcefn map_error(self, code: impl Into<ErrorCode>) -> Result<T, ErrorObjectOwned>
fn map_error(self, code: impl Into<ErrorCode>) -> Result<T, ErrorObjectOwned>
Maps errors to [jsonrpsee_types::ErrorObjectOwned
] with a specific error code.
Sourcefn map_error_with_prefix(
self,
code: impl Into<ErrorCode>,
msg_prefix: impl ToString,
) -> Result<T, ErrorObjectOwned>
fn map_error_with_prefix( self, code: impl Into<ErrorCode>, msg_prefix: impl ToString, ) -> Result<T, ErrorObjectOwned>
Maps errors to [jsonrpsee_types::ErrorObjectOwned
] with a prefixed message and a specific error code.
Provided Methods§
Sourcefn map_misc_error(self) -> Result<T, ErrorObjectOwned>
fn map_misc_error(self) -> Result<T, ErrorObjectOwned>
Maps errors to [jsonrpsee_types::ErrorObjectOwned
] with a LegacyCode::Misc
error code.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.