From 41a87ba9849eda0e572e2af29439db1047e85eb2 Mon Sep 17 00:00:00 2001 From: ryardley Date: Sat, 7 Dec 2024 18:15:48 +1100 Subject: [PATCH] Remove expect --- packages/ciphernode/config/src/app_config.rs | 3 ++- packages/ciphernode/enclave_node/src/ciphernode.rs | 4 +--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/ciphernode/config/src/app_config.rs b/packages/ciphernode/config/src/app_config.rs index 7f646348..fd452429 100644 --- a/packages/ciphernode/config/src/app_config.rs +++ b/packages/ciphernode/config/src/app_config.rs @@ -48,7 +48,8 @@ impl RPC { match self { RPC::Http(url) | RPC::Https(url) => Ok(url.clone()), RPC::Ws(url) | RPC::Wss(url) => { - let mut parsed = Url::parse(url).expect(&format!("Failed to parse URL: {}", url)); + let mut parsed = + Url::parse(url).context(format!("Failed to parse URL: {}", url))?; parsed .set_scheme(if self.is_secure() { "https" } else { "http" }) .map_err(|_| anyhow!("http(s) are valid schemes"))?; diff --git a/packages/ciphernode/enclave_node/src/ciphernode.rs b/packages/ciphernode/enclave_node/src/ciphernode.rs index 6448e616..5b1e60d9 100644 --- a/packages/ciphernode/enclave_node/src/ciphernode.rs +++ b/packages/ciphernode/enclave_node/src/ciphernode.rs @@ -24,9 +24,7 @@ pub async fn setup_ciphernode( config: AppConfig, address: Address, ) -> Result<(Addr, JoinHandle>, String)> { - let rng = Arc::new(Mutex::new( - rand_chacha::ChaCha20Rng::from_rng(OsRng).expect("Failed to create RNG"), - )); + let rng = Arc::new(Mutex::new(rand_chacha::ChaCha20Rng::from_rng(OsRng)?)); let bus = EventBus::new(true).start(); let cipher = Arc::new(Cipher::from_config(&config).await?); let store = setup_datastore(&config, &bus)?;