whos_your_daddy_common 0.1.2

Common source code for the Who's Your Daddy projects, like the Enumerator and Presenter.
Documentation
//! Error type definitions for the library.

#![warn(missing_docs)]

use thiserror::Error;

/// This `Error` type describes the possible errors that could occur in common
/// code within this library.
#[derive(Error, Debug)]
pub enum Error {
    /// Error describing some failure while processing common configuration.
    #[error("An error occurred while gathering common configuration: {0}")]
    ConfigError(String),

    /// This error indicates the API Key for the Congress.gov API could not
    /// be retrieved from the environment.
    #[error("An error occurred while retrieving the congress.gov API key from the environment: {0}")]
    CongressGovApiKeyError(String),
    
    /// This error indicates an HTTP GET request to Congress.gov failed.
    #[error("An error occurred while performing an HTTP GET request to the congress.gov API: {0}")]
    CongressGovHttpGetError(String),

    /// This error indicates the response body from Congress.gov could not
    /// be read.
    #[error("An error occurred while reading the HTTP response body: {0}")]
    CongressGovResponseError(String),

    /// Error when a name string failed to be split into its constituent parts.
    #[error("Failed to split a name string: {0}")]
    NameSplitError(String),

    /// Error to indicate a failure occurred when connecting to the PostgreSQL
    /// server.
    #[error("Failed to connect and obtain a connection pool for the PostgreSQL database server: {0}")]
    PgConnectError(String),

    /// This error indicates an SQL INSERT operation into the PostgreSQL
    /// database failed.
    #[error("Failed to complete an INSERT operation: {0}")]
    PgInsertError(String),

    /// This error indicates an SQL SELECT query failed.
    #[error("A SELECT query failed to obtain the requested data: {0}")]
    PgSelectError(String),
}