pub struct ErrorData {
pub code: ErrorCode,
pub message: Cow<'static, str>,
pub data: Option<Value>,
}
Expand description
Error information for JSON-RPC error responses.
Fields§
§code: ErrorCode
The error type that occurred.
message: Cow<'static, str>
A short description of the error. The message SHOULD be limited to a concise single sentence.
data: Option<Value>
Additional information about the error. The value of this member is defined by the sender (e.g. detailed error information, nested errors etc.).
Implementations§
Source§impl ErrorData
impl ErrorData
pub fn new( code: ErrorCode, message: impl Into<Cow<'static, str>>, data: Option<Value>, ) -> ErrorData
pub fn resource_not_found( message: impl Into<Cow<'static, str>>, data: Option<Value>, ) -> ErrorData
pub fn parse_error( message: impl Into<Cow<'static, str>>, data: Option<Value>, ) -> ErrorData
pub fn invalid_request( message: impl Into<Cow<'static, str>>, data: Option<Value>, ) -> ErrorData
pub fn method_not_found<M>() -> ErrorDatawhere
M: ConstString,
pub fn invalid_params( message: impl Into<Cow<'static, str>>, data: Option<Value>, ) -> ErrorData
pub fn internal_error( message: impl Into<Cow<'static, str>>, data: Option<Value>, ) -> ErrorData
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ErrorData
impl<'de> Deserialize<'de> for ErrorData
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ErrorData, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ErrorData, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Error for ErrorData
impl Error for ErrorData
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 Serialize for ErrorData
impl Serialize for ErrorData
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for ErrorData
Auto Trait Implementations§
impl Freeze for ErrorData
impl RefUnwindSafe for ErrorData
impl Send for ErrorData
impl Sync for ErrorData
impl Unpin for ErrorData
impl UnwindSafe for ErrorData
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string
, but without panic on OOM.