Skip to main content

ErrorCode

Struct ErrorCode 

Source
pub struct ErrorCode;
Expand description

Standard JSON-RPC 2.0 error codes.

The range from -32768 to -32000 is reserved for pre-defined errors. The range from -32000 to -32099 is reserved for server errors. All other codes are available for application-defined errors.

Implementations§

Source§

impl ErrorCode

Source

pub const PARSE_ERROR: i32 = -32700

Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text.

Source

pub const INVALID_REQUEST: i32 = -32600

The JSON sent is not a valid Request object.

Source

pub const METHOD_NOT_FOUND: i32 = -32601

The method does not exist / is not available.

Source

pub const INVALID_PARAMS: i32 = -32602

Invalid method parameter(s).

Source

pub const INTERNAL_ERROR: i32 = -32603

Internal JSON-RPC error.

Source

pub const SERVER_ERROR_MIN: i32 = -32099

The lowest reserved server error code.

Source

pub const SERVER_ERROR_MAX: i32 = -32000

The highest reserved server error code.

Source

pub fn is_reserved(code: i32) -> bool

Returns true if the given code is in the reserved pre-defined error range.

Source

pub fn is_server_error(code: i32) -> bool

Returns true if the given code is in the server error range.

Source

pub fn default_message(code: i32) -> &'static str

Returns a human-readable default message for a given standard error code.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.