Log a database error and initiate graceful shutdown.
(&self, e: impl std::fmt::Display, op: &str)
| 49 | |
| 50 | /// Log a database error, initiate graceful shutdown, and return the error so callers |
| 51 | /// can propagate it and fence any consensus-critical side effects that must not run on |
| 52 | /// state that failed to persist. |
| 53 | fn handle_db_error(&self, e: impl std::fmt::Display, op: &str) -> anyhow::Error { |
| 54 | error!(target: "critical", %e, op, "fatal database error, initiating shutdown"); |
| 55 | #[cfg(feature = "prom")] |
| 56 | metrics::counter!("critical_errors_total", "reason" => "fatal_db_error", "severity" => "critical").increment(1); |
| 57 | self.cancellation_token.cancel(); |
| 58 | anyhow::anyhow!("fatal database error in {op}: {e}") |
| 59 | } |
no outgoing calls
no test coverage detected