x-rs 0.1.0

x private library
Documentation
use thiserror::Error;

#[derive(Debug, Error)]
pub enum Error {
    #[error("http request failed / {0}")]
    Http(#[from] reqwest::Error),

    #[error("json parsing failed / {0}")]
    Json(#[from] serde_json::Error),

    #[error("io error / {0}")]
    Io(#[from] std::io::Error),

    #[error("authentication required")]
    AuthRequired,

    #[error("invalid credentials")]
    InvalidCredentials,

    #[error("rate limited")]
    RateLimited(Option<u64>),

    #[error("user not found / {0}")]
    UserNotFound(String),

    #[error("tweet not found / {0}")]
    TweetNotFound(String),

    #[error("operation not found / {0}")]
    OperationNotFound(String),

    #[error("guest token failed")]
    GuestTokenFailed,

    #[error("session expired")]
    SessionExpired,

    #[error("blocked")]
    Blocked,

    #[error("{0}")]
    Api(String),
}

pub type Result<T> = std::result::Result<T, Error>;