From 1650e939203a1b3fa2e7410cba93bea548a2b405 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Tue, 30 Jul 2024 10:55:35 +0100 Subject: [PATCH] feat: return better errors to user on server failure --- crates/cli/src/main.rs | 2 +- crates/cli/src/server/mod.rs | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/crates/cli/src/main.rs b/crates/cli/src/main.rs index 15295b05..e5f3b9c9 100644 --- a/crates/cli/src/main.rs +++ b/crates/cli/src/main.rs @@ -51,7 +51,7 @@ fn main() -> Result<()> { } Server::Start => { let sleep_duration = std::time::Duration::from_secs(10); - server::start(fs, net, repository_factory, sleep_duration); + server::start(fs, net, repository_factory, sleep_duration)?; } }, } diff --git a/crates/cli/src/server/mod.rs b/crates/cli/src/server/mod.rs index 3d9f0f81..2ec68d45 100644 --- a/crates/cli/src/server/mod.rs +++ b/crates/cli/src/server/mod.rs @@ -37,7 +37,7 @@ pub fn start( net: Network, repo: Box, sleep_duration: std::time::Duration, -) { +) -> Result<()> { init_logging(); let execution = async move { @@ -57,9 +57,8 @@ pub fn start( }; let system = System::new(); Arbiter::current().spawn(execution); - if let Err(err) = system.run() { - tracing::error!(?err, "") - }; + system.run()?; + Ok(()) } pub fn init_logging() {