diff --git a/commons/zenoh-runtime/src/lib.rs b/commons/zenoh-runtime/src/lib.rs index 2023c63bb3..7c28218a5f 100644 --- a/commons/zenoh-runtime/src/lib.rs +++ b/commons/zenoh-runtime/src/lib.rs @@ -177,8 +177,11 @@ impl ZRuntimePool { self.0 .get(&zrt) - .expect("The hashmap should contains {zrt} after initialization") - .get_or_init(|| zrt.init().expect("Failed to init {zrt}")) + .unwrap_or_else(|| panic!("The hashmap should contains {zrt} after initialization")) + .get_or_init(|| { + zrt.init() + .unwrap_or_else(|_| panic!("Failed to init {zrt}")) + }) .handle() } }