• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

vnvo / deltaforge / 20766227608

07 Jan 2026 12:14AM UTC coverage: 46.53% (-2.4%) from 48.884%
20766227608

push

github

vnvo
add postgres to the summary links too

3667 of 7881 relevant lines covered (46.53%)

2.35 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/crates/sources/src/postgres/postgres_errors.rs
1
//! PostgreSQL source error types.
2

3
use deltaforge_core::SourceError;
4
use thiserror::Error;
5

6
#[derive(Debug, Error)]
7
pub enum PostgresSourceError {
8
    #[error("invalid postgres dsn: {0}")]
9
    InvalidDsn(String),
10

11
    #[error("replication connection failed: {0}")]
12
    ReplicationConnect(String),
13

14
    #[error("auth failed: {0}")]
15
    Auth(String),
16

17
    #[error("publication '{publication}' not found")]
18
    PublicationNotFound { publication: String },
19

20
    #[error("replication slot '{slot}' not found")]
21
    SlotNotFound { slot: String },
22

23
    #[error("schema resolution failed for table {schema}.{table}: {details}")]
24
    Schema {
25
        schema: String,
26
        table: String,
27
        details: String,
28
    },
29

30
    #[error("checkpoint load failed: {0}")]
31
    Checkpoint(String),
32

33
    #[error("LSN parse error: {0}")]
34
    LsnParse(String),
35

36
    #[error("pgoutput protocol error: {0}")]
37
    Protocol(String),
38

39
    #[error("I/O error: {0}")]
40
    Io(#[from] std::io::Error),
41

42
    #[error("database error: {0}")]
43
    Database(String),
44

45
    #[error("replication error: {0}")]
46
    Replication(String),
47
}
48

49
impl From<PostgresSourceError> for SourceError {
50
    fn from(e: PostgresSourceError) -> Self {
×
51
        match e {
×
52
            PostgresSourceError::InvalidDsn(dsn) => SourceError::Incompatible {
×
53
                details: format!("invalid PostgreSQL DSN: {dsn}").into(),
×
54
            },
×
55
            PostgresSourceError::ReplicationConnect(msg) => {
×
56
                SourceError::Connect {
×
57
                    details: msg.into(),
×
58
                }
×
59
            }
60
            PostgresSourceError::Auth(msg) => SourceError::Auth {
×
61
                details: msg.into(),
×
62
            },
×
63
            PostgresSourceError::PublicationNotFound { publication } => {
×
64
                SourceError::Incompatible {
×
65
                    details: format!("publication '{publication}' not found")
×
66
                        .into(),
×
67
                }
×
68
            }
69
            PostgresSourceError::SlotNotFound { slot } => {
×
70
                SourceError::Incompatible {
×
71
                    details: format!("replication slot '{slot}' not found")
×
72
                        .into(),
×
73
                }
×
74
            }
75
            PostgresSourceError::Schema {
76
                schema,
×
77
                table,
×
78
                details,
×
79
            } => SourceError::Schema {
×
80
                details: format!("{schema}.{table}: {details}").into(),
×
81
            },
×
82
            PostgresSourceError::Checkpoint(msg) => SourceError::Checkpoint {
×
83
                details: msg.into(),
×
84
            },
×
85
            PostgresSourceError::LsnParse(msg) => SourceError::Incompatible {
×
86
                details: format!("LSN parse error: {msg}").into(),
×
87
            },
×
88
            PostgresSourceError::Protocol(msg) => {
×
89
                SourceError::Other(anyhow::anyhow!(msg))
×
90
            }
91
            PostgresSourceError::Io(e) => SourceError::Io(e),
×
92
            PostgresSourceError::Database(msg) => {
×
93
                SourceError::Other(anyhow::anyhow!("database error: {msg}"))
×
94
            }
95
            PostgresSourceError::Replication(msg) => {
×
96
                SourceError::Other(anyhow::anyhow!("replication error: {msg}"))
×
97
            }
98
        }
99
    }
×
100
}
101

102
impl From<tokio_postgres::Error> for PostgresSourceError {
103
    fn from(e: tokio_postgres::Error) -> Self {
×
104
        PostgresSourceError::Database(e.to_string())
×
105
    }
×
106
}
107

108
impl From<pgwire_replication::PgWireError> for PostgresSourceError {
109
    fn from(e: pgwire_replication::PgWireError) -> Self {
×
110
        PostgresSourceError::Replication(e.to_string())
×
111
    }
×
112
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc