rpc_router/router/call_error.rs
1use crate::{CallSuccess, RpcId};
2
3pub type CallResult = core::result::Result<CallSuccess, CallError>;
4
5/// The Error type returned by `rpc_router.call...` functions.
6///
7/// NOTE: CallSuccess & CallError
8/// are not designed to be the JSON-RPC Response
9/// or Error, but to provide the necessary context
10/// to build those, as well as the useful `method name`
11/// context for tracing/login.
12#[derive(Debug)]
13pub struct CallError {
14 pub id: RpcId,
15 pub method: String,
16 pub error: crate::Error,
17}
18
19// region: --- Error Boilerplate
20
21impl core::fmt::Display for CallError {
22 fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::result::Result<(), core::fmt::Error> {
23 write!(fmt, "{self:?}")
24 }
25}
26
27impl std::error::Error for CallError {}
28
29// endregion: --- Error Boilerplate