diff --git a/components/chainhook-cli/src/service/mod.rs b/components/chainhook-cli/src/service/mod.rs index 5fa32a2..8f3e516 100644 --- a/components/chainhook-cli/src/service/mod.rs +++ b/components/chainhook-cli/src/service/mod.rs @@ -363,20 +363,11 @@ fn load_predicates_from_redis( ctx: &Context, ) -> Result, String> { let redis_config = config.expected_redis_config(); - let client = redis::Client::open(redis_config.uri.clone()).unwrap(); - let mut redis_con = match client.get_connection() { - Ok(con) => con, - Err(message) => { - error!( - ctx.expect_logger(), - "Unable to connect to redis server: {}", - message.to_string() - ); - std::thread::sleep(std::time::Duration::from_secs(1)); - std::process::exit(1); - } - }; - + let client = redis::Client::open(redis_config.uri.clone()) + .map_err(|e| format!("unable to connect to redis: {}", e.to_string()))?; + let mut redis_con = client + .get_connection() + .map_err(|e| format!("unable to connect to redis: {}", e.to_string()))?; let chainhooks_to_load: Vec = redis_con .scan_match("chainhook:*:*:*") .map_err(|e| format!("unable to connect to redis: {}", e.to_string()))?