From 3b37793ab2d4e9cb3a801382994c9c369a5698d0 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Thu, 13 Aug 2026 16:43:35 +0000 Subject: [PATCH] lib: Print error message from load_config function when panicing The current implementation discards the essential information of the error, such as whether the file was missing, or unreadable, or if there was an error in deserializing. This adds the underlying error message to the panic, which can help debug invalid configurations. Related: https://github.com/flatpak/flat-manager/issues/156 --- src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 7c07aaf..071735c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -37,8 +37,8 @@ type Pool = diesel::r2d2::Pool>; pub const MIGRATIONS: EmbeddedMigrations = embed_migrations!("migrations/"); pub fn load_config(path: &path::Path) -> Arc { - let config_data = - app::load_config(path).unwrap_or_else(|_| panic!("Failed to read config file {:?}", path)); + let config_data = app::load_config(path) + .unwrap_or_else(|e| panic!("Failed to read config file: {}, in {:?}", e, path)); Arc::new(config_data) }