Sigil documentation
ReferenceRust referencesigil-rpc

sigil-rpc · error

Source declarations, signatures and documentation for error.

Source: sigil/node/sigil-rpc/src/error.rs. SHA-256: 1d8165adaaba96ea8c969de7eeb4e0012211d9028dbbb68c371153dcf03b8506.

This reference follows declared source modules, retains conditional attributes, and includes public declarations and implementation methods. Private-module re-exports and trait resolution require the compiler; this is a source reference, not a claim that every listed item is a root import. Function bodies and constant values are omitted.

error::RpcApiError

High-level RPC API errors.

Each variant maps to a JSON-RPC error code and can be converted into an [RpcError] for inclusion in a response envelope.

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, thiserror::Error)]
pub enum RpcApiError {
    /// The request could not be parsed as valid JSON.
    #[error("parse error: {0}")]
    ParseError(String),

    /// The request JSON is not a valid JSON-RPC 2.0 request object.
    #[error("invalid request: {0}")]
    InvalidRequest(String),

    /// The requested method does not exist.
    #[error("method not found: {0}")]
    MethodNotFound(String),

    /// The parameters for the method are invalid.
    #[error("invalid params: {0}")]
    InvalidParams(String),

    /// An internal server error occurred.
    #[error("internal error: {0}")]
    InternalError(String),

    /// The requested resource was not found (block, tx, validator, etc.).
    #[error("not found: {0}")]
    NotFound(String),

    /// The request requires authentication that was not provided or is invalid.
    #[error("unauthorized: {0}")]
    Unauthorized(String),

    /// The caller has exceeded the rate limit.
    #[error("rate limited")]
    RateLimited,
}

Source line: 24.

error::RpcApiError::code

Returns the standard JSON-RPC error code for this error.

pub fn code(&self) -> i32;

Source line: 60.

error::RpcApiError::to_rpc_error

Convert into a JSON-RPC [RpcError] object.

pub fn to_rpc_error(&self) -> RpcError;

Source line: 74.

On this page