pub struct CallError {
pub code: ErrorCode,
pub description: String,
pub details: Value,
}Expand description
The body of a CALLERROR (or, in 2.1, a CALLRESULTERROR).
Fields§
§code: ErrorCodeThe RPC framework error code.
description: StringShort human-readable description. Empty is allowed; the spec suggests "".
details: ValueFree-form details object. Never null on the wire — an empty object is used.
Implementations§
Source§impl CallError
impl CallError
Sourcepub fn new(code: ErrorCode, description: impl Into<String>) -> Self
pub fn new(code: ErrorCode, description: impl Into<String>) -> Self
Builds a CALLERROR body with an empty details object.
Sourcepub fn with_details(self, details: Value) -> Self
pub fn with_details(self, details: Value) -> Self
Attaches a details object.
Sourcepub fn not_implemented(action: &str) -> Self
pub fn not_implemented(action: &str) -> Self
The action is not known to this implementation.
Sourcepub fn not_supported(action: &str) -> Self
pub fn not_supported(action: &str) -> Self
The action is known but this peer does not handle it.
Trait Implementations§
Source§impl Error for CallError
Available on crate feature std only.
impl Error for CallError
Available on crate feature
std only.1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl From<&CallError> for CallErrorRef<'static>
impl From<&CallError> for CallErrorRef<'static>
Source§impl From<CallError> for CallErrorRef<'static>
impl From<CallError> for CallErrorRef<'static>
Source§impl From<DecodeError> for CallError
impl From<DecodeError> for CallError
Source§fn from(error: DecodeError) -> Self
fn from(error: DecodeError) -> Self
Maps a decoding failure onto the error code the specification prescribes, and puts
the offending JSON pointer into errorDetails so the peer can find it.
impl StructuralPartialEq for CallError
Auto Trait Implementations§
impl Forget for CallError
impl Freeze for CallError
impl RefUnwindSafe for CallError
impl Send for CallError
impl Sync for CallError
impl Unpin for CallError
impl UnsafeUnpin for CallError
impl UnwindSafe for CallError
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