Skip to content

Commit 655e4ff

Browse files
committed
Explain context(false) and improve error messages
1 parent d445d37 commit 655e4ff

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

  • crates/stackable-operator/src/database_connections

crates/stackable-operator/src/database_connections/mod.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,21 @@ mod helpers;
66
#[cfg(test)]
77
mod tests;
88

9+
/// Aggregates errors from database-specific submodules.
10+
///
11+
/// All variants use `context(false)` to enable automatic [`From`] conversion,
12+
/// so callers can use `?` directly without needing `.context(SomeSnafu)`.
913
#[derive(Debug, Snafu)]
1014
pub enum Error {
11-
#[snafu(context(false), display("PostgreSQL error"))]
15+
#[snafu(context(false), display("PostgreSQL database connection error"))]
1216
Postgresql {
1317
source: databases::postgresql::Error,
1418
},
1519

16-
#[snafu(context(false), display("MySQL error"))]
20+
#[snafu(context(false), display("MySQL database connection error"))]
1721
Mysql { source: databases::mysql::Error },
1822

19-
#[snafu(context(false), display("Derby error"))]
23+
#[snafu(context(false), display("Derby database connection error"))]
2024
Derby { source: databases::derby::Error },
2125
}
2226

0 commit comments

Comments
 (0)