takoyaki_core 1.2.0

Core package to build plugins for takoyaki
Documentation
use thiserror::Error;

/// Defines all the errors returned by takoyaki SDK
#[derive(Debug, Error)]
pub enum TakoyakiError {
    /// Error caused by reading files
    #[error("Error while reading file: ")]
    ReadError(#[from] std::io::Error),

    /// Error caused by parsing JSON
    #[error("Error while parsing data")]
    ParseError(#[from] serde_json::Error),

    /// Error caused by parsing config
    #[error("Invalid config found")]
    ConfigParseError(#[from] serde_yaml::Error),

    /// Error caused when converting hex to rgb
    #[error("Invalid hex code: Cannot convert to rgb")]
    RgbParseError(#[from] colorsys::ParseError),

    /// Error caused when getting the root
    #[error("Invalid root found: `{0}`")]
    InvalidRoot(String),

    /// Error when getting unexpected results when parsing
    #[error("Invalid root found! Expected: `{0}`")]
    UnexpectedType(String),

    /// Error when getting unexpected results when parsing
    #[error("Root cannot be found: `{0}`")]
    RootNotFound(String),

    /// Error when making requests
    #[error("Error while fetching URL")]
    ReqwestError(#[from] reqwest::Error),
}