pub struct RpcError {
pub error_struct: Option<RpcErrorKind>,
pub code: i64,
pub message: String,
pub data: Option<Value>,
}Expand description
This struct may be returned from JSON RPC server in case of error It is expected that that this struct has impls From<_> all other RPC errors like RpcBlockError
Fields§
§error_struct: Option<RpcErrorKind>§code: i64Deprecated please use the error_struct instead
message: StringDeprecated please use the error_struct instead
data: Option<Value>Deprecated please use the error_struct instead
Implementations§
Source§impl RpcError
impl RpcError
Sourcepub fn new(code: i64, message: String, data: Option<Value>) -> Self
pub fn new(code: i64, message: String, data: Option<Value>) -> Self
A generic constructor.
Mostly for completeness, doesn’t do anything but filling in the corresponding fields.
Sourcepub fn parse_error(e: String) -> Self
pub fn parse_error(e: String) -> Self
Create a parse error.
pub fn serialization_error(e: String) -> Self
Sourcepub fn new_internal_or_handler_error(
error_data: Option<Value>,
error_struct: Value,
) -> Self
pub fn new_internal_or_handler_error( error_data: Option<Value>, error_struct: Value, ) -> Self
Helper method to define extract INTERNAL_ERROR in separate RpcErrorKind Returns HANDLER_ERROR if the error is not internal one
pub fn new_internal_error(error_data: Option<Value>, info: String) -> Self
Sourcepub fn method_not_found(method: String) -> Self
pub fn method_not_found(method: String) -> Self
Create a method not found error.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for RpcError
impl<'de> Deserialize<'de> for RpcError
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<Infallible> for RpcError
impl From<Infallible> for RpcError
Source§fn from(_: Infallible) -> Self
fn from(_: Infallible) -> Self
Converts to this type from the input type.
Source§impl From<RpcAllMinersError> for RpcError
impl From<RpcAllMinersError> for RpcError
Source§fn from(error: RpcAllMinersError) -> Self
fn from(error: RpcAllMinersError) -> Self
Converts to this type from the input type.
Source§impl From<RpcBlockError> for RpcError
impl From<RpcBlockError> for RpcError
Source§fn from(error: RpcBlockError) -> Self
fn from(error: RpcBlockError) -> Self
Converts to this type from the input type.
Source§impl From<RpcChunkError> for RpcError
impl From<RpcChunkError> for RpcError
Source§fn from(error: RpcChunkError) -> Self
fn from(error: RpcChunkError) -> Self
Converts to this type from the input type.
Source§impl From<RpcClientConfigError> for RpcError
impl From<RpcClientConfigError> for RpcError
Source§fn from(error: RpcClientConfigError) -> Self
fn from(error: RpcClientConfigError) -> Self
Converts to this type from the input type.
Source§impl From<RpcGasPriceError> for RpcError
impl From<RpcGasPriceError> for RpcError
Source§fn from(error: RpcGasPriceError) -> Self
fn from(error: RpcGasPriceError) -> Self
Converts to this type from the input type.
Source§impl From<RpcLightClientNextBlockError> for RpcError
impl From<RpcLightClientNextBlockError> for RpcError
Source§fn from(error: RpcLightClientNextBlockError) -> Self
fn from(error: RpcLightClientNextBlockError) -> Self
Converts to this type from the input type.
Source§impl From<RpcLightClientProofError> for RpcError
impl From<RpcLightClientProofError> for RpcError
Source§fn from(error: RpcLightClientProofError) -> Self
fn from(error: RpcLightClientProofError) -> Self
Converts to this type from the input type.
Source§impl From<RpcMaintenanceWindowsError> for RpcError
impl From<RpcMaintenanceWindowsError> for RpcError
Source§fn from(error: RpcMaintenanceWindowsError) -> Self
fn from(error: RpcMaintenanceWindowsError) -> Self
Converts to this type from the input type.
Source§impl From<RpcNetworkInfoError> for RpcError
impl From<RpcNetworkInfoError> for RpcError
Source§fn from(error: RpcNetworkInfoError) -> Self
fn from(error: RpcNetworkInfoError) -> Self
Converts to this type from the input type.
Source§impl From<RpcParseError> for RpcError
impl From<RpcParseError> for RpcError
Source§fn from(parse_error: RpcParseError) -> Self
fn from(parse_error: RpcParseError) -> Self
Converts to this type from the input type.
Source§impl From<RpcProtocolConfigError> for RpcError
impl From<RpcProtocolConfigError> for RpcError
Source§fn from(error: RpcProtocolConfigError) -> Self
fn from(error: RpcProtocolConfigError) -> Self
Converts to this type from the input type.
Source§impl From<RpcProviderError> for RpcError
impl From<RpcProviderError> for RpcError
Source§fn from(error: RpcProviderError) -> Self
fn from(error: RpcProviderError) -> Self
Converts to this type from the input type.
Source§impl From<RpcQueryError> for RpcError
impl From<RpcQueryError> for RpcError
Source§fn from(error: RpcQueryError) -> Self
fn from(error: RpcQueryError) -> Self
Converts to this type from the input type.
Source§impl From<RpcReceiptError> for RpcError
impl From<RpcReceiptError> for RpcError
Source§fn from(error: RpcReceiptError) -> Self
fn from(error: RpcReceiptError) -> Self
Converts to this type from the input type.
Source§impl From<RpcSandboxFastForwardError> for RpcError
impl From<RpcSandboxFastForwardError> for RpcError
Source§fn from(error: RpcSandboxFastForwardError) -> Self
fn from(error: RpcSandboxFastForwardError) -> Self
Converts to this type from the input type.
Source§impl From<RpcSandboxPatchStateError> for RpcError
impl From<RpcSandboxPatchStateError> for RpcError
Source§fn from(error: RpcSandboxPatchStateError) -> Self
fn from(error: RpcSandboxPatchStateError) -> Self
Converts to this type from the input type.
Source§impl From<RpcSplitStorageInfoError> for RpcError
impl From<RpcSplitStorageInfoError> for RpcError
Source§fn from(error: RpcSplitStorageInfoError) -> Self
fn from(error: RpcSplitStorageInfoError) -> Self
Converts to this type from the input type.
Source§impl From<RpcStateChangesError> for RpcError
impl From<RpcStateChangesError> for RpcError
Source§fn from(error: RpcStateChangesError) -> Self
fn from(error: RpcStateChangesError) -> Self
Converts to this type from the input type.
Source§impl From<RpcStatusError> for RpcError
impl From<RpcStatusError> for RpcError
Source§fn from(error: RpcStatusError) -> Self
fn from(error: RpcStatusError) -> Self
Converts to this type from the input type.
Source§impl From<RpcTransactionError> for RpcError
impl From<RpcTransactionError> for RpcError
Source§fn from(error: RpcTransactionError) -> Self
fn from(error: RpcTransactionError) -> Self
Converts to this type from the input type.
Source§impl From<RpcValidatorError> for RpcError
impl From<RpcValidatorError> for RpcError
Source§fn from(error: RpcValidatorError) -> Self
fn from(error: RpcValidatorError) -> Self
Converts to this type from the input type.
Source§impl From<ServerError> for RpcError
impl From<ServerError> for RpcError
Source§fn from(e: ServerError) -> RpcError
fn from(e: ServerError) -> RpcError
Converts to this type from the input type.
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 UnwindSafe for RpcError
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
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 more