footing 0.4.4

Feature-gated foundations for Rust backend services
Documentation
use thiserror::Error;

#[derive(Debug, Error)]
#[non_exhaustive]
/// Errors that can occur while handling testkit.
pub enum TestkitError {
    /// The database address is not a valid PostgreSQL URL.
    #[error("test database URL must be valid and use the postgres or postgresql scheme")]
    InvalidPostgresUrl,
    /// The database name is empty, contains control characters, or exceeds 63 bytes.
    #[error(
        "test database name must contain non-whitespace text, contain no control characters, and not exceed 63 bytes"
    )]
    InvalidDatabaseName,
    /// Indicates request build.
    #[error("test request build failed: {0}")]
    RequestBuild(#[source] axum::http::Error),
    /// Indicates response body.
    #[error("response body read failed: {0}")]
    ResponseBody(#[source] axum::Error),
    /// Indicates response UTF-8.
    #[error("response body is not UTF-8: {0}")]
    ResponseUtf8(#[source] std::string::FromUtf8Error),
    /// Indicates response JSON.
    #[error("response body is not JSON: {0}")]
    ResponseJson(#[source] serde_json::Error),
    /// The problem body status differs from the HTTP response status.
    #[error("problem status {problem_status} does not match HTTP status {http_status}")]
    ResponseStatusMismatch {
        /// Status of the HTTP response.
        http_status: u16,
        /// Status declared by the problem body.
        problem_status: u16,
    },
}