From 2db18bb3aac7461d89df1e73bcf57fe613be4785 Mon Sep 17 00:00:00 2001 From: OMGeeky Date: Sat, 20 Apr 2024 12:26:18 +0200 Subject: [PATCH] print simple error when loading config failed --- src/main.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 89aa672..c525985 100644 --- a/src/main.rs +++ b/src/main.rs @@ -15,7 +15,14 @@ async fn main() -> Result<()> { .init(); info!("Hello, world!"); - run().await?; + let x = run().await; + x.or_else(|e| match e { + DownloaderError::LoadConfig(e) => { + println!("Error while loading config: {}", e); + Ok(()) + } + e => Err(e), + })?; info!("Bye"); Ok(()) @@ -28,7 +35,10 @@ async fn run() -> Result<()> { .file("./settings.toml") .file("/home/omgeeky/twba/config.toml") .load() - .map_err(|e| DownloaderError::LoadConfig(e.into()))?; + .map_err(|e| { + error!("Failed to load config: {:?}", e); + DownloaderError::LoadConfig(e.into()) + })?; let db = local_db::open_database(Some(&conf.db_url)).await?; local_db::migrate_db(&db).await?;