use thiserror::Error;
#[derive(Debug, Error)]
#[non_exhaustive]
pub enum Error {
#[cfg(feature = "pgstac")]
#[error(transparent)]
Bb8TokioPostgresRun(#[from] bb8::RunError<tokio_postgres::Error>),
#[cfg(feature = "duckdb")]
#[error(transparent)]
Bb8DuckdbRun(#[from] Box<bb8::RunError<Error>>),
#[cfg(feature = "duckdb")]
#[error(transparent)]
StacDuckdb(#[from] stac_duckdb::Error),
#[error("memory backend error: {0}")]
MemoryBackend(String),
#[cfg(feature = "pgstac")]
#[error(transparent)]
Pgstac(#[from] pgstac::Error),
#[error(transparent)]
SerdeJson(#[from] serde_json::Error),
#[error(transparent)]
SerdeUrlencodedSer(#[from] serde_urlencoded::ser::Error),
#[error(transparent)]
Stac(#[from] stac::Error),
#[error("this backend is read-only")]
ReadOnly,
#[cfg(feature = "pgstac")]
#[error(transparent)]
TokioPostgres(#[from] tokio_postgres::Error),
#[error(transparent)]
TryFromInt(#[from] std::num::TryFromIntError),
#[error(transparent)]
UrlParse(#[from] url::ParseError),
}