entelix_graphmemory_pg/
error.rs1use thiserror::Error;
6
7use entelix_core::error::Error;
8
9pub type PgGraphMemoryResult<T> = std::result::Result<T, PgGraphMemoryError>;
11
12#[derive(Debug, Error)]
14#[non_exhaustive]
15pub enum PgGraphMemoryError {
16 #[error("postgres transport failure: {0}")]
18 Sqlx(#[from] sqlx::Error),
19
20 #[error("malformed row shape: {0}")]
24 Malformed(String),
25
26 #[error("configuration error: {0}")]
29 Config(String),
30
31 #[error("payload codec failure: {0}")]
33 Codec(#[from] serde_json::Error),
34}
35
36impl From<PgGraphMemoryError> for Error {
37 fn from(err: PgGraphMemoryError) -> Self {
38 match err {
39 PgGraphMemoryError::Config(msg) => Self::config(msg),
40 PgGraphMemoryError::Codec(e) => Self::Serde(e),
41 other => Self::provider_network_from(other),
42 }
43 }
44}