From 136e7ddddf955f41005bb341d2edf8732a9562e9 Mon Sep 17 00:00:00 2001 From: Runji Wang Date: Wed, 5 Jul 2023 17:24:29 +0800 Subject: [PATCH] panic on invalid format Signed-off-by: Runji Wang --- madsim-tonic/src/sim.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/madsim-tonic/src/sim.rs b/madsim-tonic/src/sim.rs index a8a26e1..12e2355 100644 --- a/madsim-tonic/src/sim.rs +++ b/madsim-tonic/src/sim.rs @@ -74,7 +74,7 @@ pub mod codegen { fn timeout(&self) -> Option { let s = self.metadata().get("grpc-timeout")?.to_str().unwrap(); let (value, unit) = s.split_at(s.len() - 1); - let value = value.parse::().ok()?; + let value = value.parse::().expect("invalid grpc-timeout value"); Some(match unit { "H" => Duration::from_secs(value * 60 * 60), "M" => Duration::from_secs(value * 60),