diff --git a/bin/node/src/commands/node.rs b/bin/node/src/commands/node.rs index 131f7747d9..d9ff61bc11 100644 --- a/bin/node/src/commands/node.rs +++ b/bin/node/src/commands/node.rs @@ -232,7 +232,11 @@ impl NodeCommand { .with_supervisor_rpc_config(supervisor_rpc_config.unwrap_or_default()) .build() .start() - .await; + .await + .map_err(|e| { + error!(target: "rollup_node", "Failed to start rollup node service: {e}"); + anyhow::anyhow!("{}", e) + })?; Ok(()) } diff --git a/crates/node/service/src/service/core.rs b/crates/node/service/src/service/core.rs index ee7950c9df..973ca95691 100644 --- a/crates/node/service/src/service/core.rs +++ b/crates/node/service/src/service/core.rs @@ -123,7 +123,7 @@ pub trait RollupNodeService { async fn supervisor_ext(&self) -> Option; /// Starts the rollup node service. - async fn start(&self) { + async fn start(&self) -> Result<(), String> { // Create a global cancellation token for graceful shutdown of tasks. let cancellation = CancellationToken::new(); @@ -233,5 +233,6 @@ pub trait RollupNodeService { (self.mode() == NodeMode::Sequencer).then_some((sequencer, sequencer_context)) ] ); + Ok(()) } } diff --git a/crates/node/service/src/service/util.rs b/crates/node/service/src/service/util.rs index d4b7c15ce2..7fc039c5ae 100644 --- a/crates/node/service/src/service/util.rs +++ b/crates/node/service/src/service/util.rs @@ -31,11 +31,15 @@ macro_rules! spawn_and_wait { tracing::error!(target: "rollup_node", "Critical error in sub-routine: {e}"); // Cancel all tasks and gracefully shutdown. $cancellation.cancel(); + return Err(e); } Err(e) => { + let error_msg = format!("Task join error: {e}"); + // Log the error and cancel all tasks. tracing::error!(target: "rollup_node", "Task join error: {e}"); // Cancel all tasks and gracefully shutdown. $cancellation.cancel(); + return Err(error_msg); } } }