use thiserror::Error;
#[derive(Debug, Error)]
#[non_exhaustive]
pub enum TestkitError {
#[error("test database URL must be valid and use the postgres or postgresql scheme")]
InvalidPostgresUrl,
#[error(
"test database name must contain non-whitespace text, contain no control characters, and not exceed 63 bytes"
)]
InvalidDatabaseName,
#[error("test request build failed: {0}")]
RequestBuild(#[source] axum::http::Error),
#[error("response body read failed: {0}")]
ResponseBody(#[source] axum::Error),
#[error("response body is not UTF-8: {0}")]
ResponseUtf8(#[source] std::string::FromUtf8Error),
#[error("response body is not JSON: {0}")]
ResponseJson(#[source] serde_json::Error),
#[error("problem response must have exactly one application/problem+json Content-Type")]
ResponseContentType,
#[error("problem status {problem_status} does not match HTTP status {http_status}")]
ResponseStatusMismatch {
http_status: u16,
problem_status: u16,
},
}