use thiserror::Error;
use entelix_core::error::Error;
pub type PgGraphMemoryResult<T> = std::result::Result<T, PgGraphMemoryError>;
#[derive(Debug, Error)]
#[non_exhaustive]
pub enum PgGraphMemoryError {
#[error("postgres transport failure: {0}")]
Sqlx(#[from] sqlx::Error),
#[error("malformed row shape: {0}")]
Malformed(String),
#[error("configuration error: {0}")]
Config(String),
#[error("payload codec failure: {0}")]
Codec(#[from] serde_json::Error),
}
impl From<PgGraphMemoryError> for Error {
fn from(err: PgGraphMemoryError) -> Self {
match err {
PgGraphMemoryError::Config(msg) => Self::config(msg),
PgGraphMemoryError::Codec(e) => Self::Serde(e),
other => Self::provider_network_from(other),
}
}
}