From 6b935f8206c0c303a172284ff580cacf46e706f8 Mon Sep 17 00:00:00 2001 From: Ruben Beltran del Rio Date: Fri, 15 Mar 2024 22:17:41 +0100 Subject: Conditional build + better error --- src/main.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src') diff --git a/src/main.rs b/src/main.rs index a611926..d3b3334 100644 --- a/src/main.rs +++ b/src/main.rs @@ -46,6 +46,22 @@ pub struct Track { #[tokio::main] async fn main() -> Result<()> { + let result = run().await; + + if cfg!(debug_assertions) { + result + } else { + match result { + Ok(_) => Ok(()), + Err(e) => { + eprintln!("Error: {}", e); + std::process::exit(1); + } + } + } +} + +async fn run() -> Result<()> { let mut configuration = Configuration::new(); let arguments = Arguments::parse(); -- cgit