aoc-toolkit 0.1.0-alpha.2

A toolkit for solving Advent of Code problems
Documentation
use reqwest::StatusCode;
use std::io;
use std::path::PathBuf;
use thiserror::Error;

#[derive(Debug, Error)]
pub enum ClientError {
    #[error("No Advent of Code session configured")]
    MissingSession,

    #[error("Invalid Advent of Code session token")]
    InvalidSession,

    #[error("Advent of Code rejected the session")]
    Unauthorized,

    #[error("The requested puzzle input is unavailable")]
    InputUnavailable,

    #[error("Advent of Code request rate limit exceeded")]
    RateLimited,

    #[error("Unexpected HTTP status: {0}")]
    UnexpectedStatus(StatusCode),

    #[error("Unexpected response from Advent of Code")]
    InvalidResponse,

    #[error("Advent of Code HTTP request failed")]
    Http(#[from] reqwest::Error),

    #[error("Filesystem operation failed for {path:?}: {source}")]
    Io {
        path: PathBuf,
        #[source]
        source: io::Error,
    },

    #[error("Cannot access the system credential store")]
    CredentialStore,

    #[error("Cannot start browser login. Try `aoc auth login --manual`")]
    BrowserUnavailable,
}