diff --git a/nym-network-monitor/src/main.rs b/nym-network-monitor/src/main.rs index ff5ed1dd20..caa764494e 100644 --- a/nym-network-monitor/src/main.rs +++ b/nym-network-monitor/src/main.rs @@ -247,10 +247,11 @@ async fn main() -> Result<()> { let derivation_material = args .derivation_material_path .map(|derivation_material_path| { - let file = File::open(derivation_material_path).unwrap(); - let derivation_material: DerivationMaterial = serde_json::from_reader(file).unwrap(); - Arc::new(Mutex::new(derivation_material)) - }); + let file = File::open(derivation_material_path)?; + let derivation_material: DerivationMaterial = serde_json::from_reader(file)?; + Ok::<_, anyhow::Error>(Arc::new(Mutex::new(derivation_material))) + }) + .transpose()?; let spawn_clients = Arc::clone(&clients); tokio::spawn(make_clients(