From 93f2e4aead2cacb65934f4e06386fa31ed70d681 Mon Sep 17 00:00:00 2001 From: mfw78 Date: Wed, 8 Apr 2026 09:20:55 +0000 Subject: [PATCH] Use err!() instead of panic!() for unrecognised DATABASE_URL Follow the established codebase convention where configuration validation errors use err!() to propagate gracefully, rather than panic!(). The error propagates through from_config() and is caught by create_db_pool() which logs and calls exit(1). --- src/db/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/db/mod.rs b/src/db/mod.rs index 89c680ba..7b989e44 100644 --- a/src/db/mod.rs +++ b/src/db/mod.rs @@ -288,12 +288,12 @@ impl DbConnType { if std::path::Path::new(url).exists() { return Ok(DbConnType::Sqlite); } - panic!( + err!(format!( "`DATABASE_URL` does not match any known database scheme (mysql://, postgresql://, sqlite://) \ and no existing SQLite database was found at '{url}'. \ If you intend to use SQLite, use an explicit `sqlite://` prefix in your `DATABASE_URL`. \ Otherwise, check your DATABASE_URL for typos or quoting issues." - ); + )) } #[cfg(not(sqlite))]