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).
This commit is contained in:
mfw78 2026-04-08 09:20:55 +00:00
parent df56449823
commit 93f2e4aead
No known key found for this signature in database
GPG Key ID: B825D32364868537

View File

@ -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))]