Report migration failures to Sentry
Migration errors were propagated via `?` and returned from `main`,
never passing through `tracing::error!()` so Sentry never saw them.
Log the error before returning so sentry-tracing can capture it, and
register MigrationError with the MietteLayer so diagnostics render.

https://claude.ai/code/session_01T4oq8AnYjs6JcobndQzTmW
change
commit d823e1acd95d13c6c078f259ce987ae1fa54b780
author Claude <noreply@anthropic.com>
date
parent vkuukurl
diff --git a/quire-server/src/bin/quire/main.rs b/quire-server/src/bin/quire/main.rs
index 572a54b..5d29ec0 100644
--- a/quire-server/src/bin/quire/main.rs
+++ b/quire-server/src/bin/quire/main.rs
@@ -114,6 +114,7 @@ async fn main() -> Result<()> {
     let miette_layer = MietteLayer::new()
         .with_type::<quire::Error>()
         .with_type::<quire::ci::Error>()
+        .with_type::<quire::db::MigrationError>()
         .with_type::<quire_core::fennel::FennelError>();
     let _guard = telemetry::init_telemetry(
         miette_layer,
diff --git a/quire-server/src/bin/quire/server.rs b/quire-server/src/bin/quire/server.rs
index 5dcbdb4..a99c7d9 100644
--- a/quire-server/src/bin/quire/server.rs
+++ b/quire-server/src/bin/quire/server.rs
@@ -49,7 +49,10 @@ pub async fn run(quire: &Quire, web_routes: axum::Router, api_routes: axum::Rout
     let db_path = quire.db_path();
     tracing::info!(path = %db_path.display(), "opening database");
     let mut db = quire::db::open(&db_path).into_diagnostic()?;
-    quire::db::migrate(&mut db)?;
+    if let Err(e) = quire::db::migrate(&mut db) {
+        tracing::error!(error = &e as &(dyn std::error::Error + 'static), "migration failed");
+        return Err(e.into());
+    }
     drop(db);
 
     // Reconcile any orphaned runs from a previous server instance.