pub struct RpcError {
pub code: i64,
pub message: String,
pub data: Option<Json>,
}Expand description
A JSON-RPC error object.
Fields§
§code: i64§message: String§data: Option<Json>Extra detail — the list of validation failures, the offending method.
Implementations§
Source§impl RpcError
impl RpcError
pub fn new(code: i64, message: impl Into<String>) -> Self
pub fn with_data(self, data: Json) -> Self
pub fn parse_error(detail: impl Display) -> Self
pub fn invalid_request(detail: impl Display) -> Self
pub fn method_not_found(method: &str) -> Self
pub fn invalid_params(detail: impl Display) -> Self
pub fn internal_error(detail: impl Display) -> Self
pub fn resource_not_found(uri: &str) -> Self
pub fn to_json(&self) -> Json
pub fn from_json(value: &Json) -> Option<RpcError>
Trait Implementations§
impl StructuralPartialEq for RpcError
Auto Trait Implementations§
impl Freeze for RpcError
impl RefUnwindSafe for RpcError
impl Send for RpcError
impl Sync for RpcError
impl Unpin for RpcError
impl UnsafeUnpin for RpcError
impl UnwindSafe for RpcError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more