Skip to main content

ErrorLike

Trait ErrorLike 

Source
pub trait ErrorLike: Display {
    // Provided methods
    fn code(&self) -> i64 { ... }
    fn message(&self) -> String { ... }
    fn data(&self) -> Option<Box<dyn Serialize + Send>> { ... }
}
Expand description

Trait that can be used to map custom errors to the Error object.

Provided Methods§

Source

fn code(&self) -> i64

Code to be used in JSON-RPC 2.0 Error object. Default is 0.

Source

fn message(&self) -> String

Message to be used in JSON-RPC 2.0 Error object. Default is the Display value of the item.

Source

fn data(&self) -> Option<Box<dyn Serialize + Send>>

Any additional data to be sent with the error. Default is None.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§