newton-core 0.4.16

newton protocol core sdk
use std::num::ParseIntError;

use const_hex::FromHexError;
use thiserror::Error;
/// Error returned by config
#[derive(Debug, Error)]
pub enum ConfigError {
    /// Failed to parse to Address or FixedBytes<32>
    #[error("FromHexError :{0}")]
    HexParse(#[from] FromHexError),
    /// Parse Error
    #[error("Parse Error :{0}")]
    ParseError(#[from] ruint::ParseError),
    /// ParseIntError
    #[error("Parse Int Error :{0}")]
    ParseIntError(#[from] ParseIntError),

    /// Error when loading configuration from environment variables.
    #[error("Failed to load server config from env: {0}")]
    LoadEnv(#[from] dotenvy::Error),

    /// Error when loading configuration from a TOML file.
    #[error("Failed to load server config from toml file: {0}")]
    LoadTOML(#[from] toml::de::Error),

    /// Error when reading or accessing configuration resources.
    #[error("Failed to read server config: {0}")]
    InvalidConfig(#[from] std::io::Error),

    /// Error when configuration is semantically invalid.
    #[error("Invalid config: {0}")]
    InvalidConfigStr(String),

    /// Missing RPC configuration for a chain ID.
    #[error("Missing RPC configuration for chain ID {chain_id}")]
    MissingRpcForChain {
        /// The chain ID that has no RPC configuration
        chain_id: u64,
    },
}