From 94f2e18814490521895246f0f7180187ee8e9a98 Mon Sep 17 00:00:00 2001 From: Ryan Williams Date: Fri, 6 Dec 2024 13:47:57 +1300 Subject: [PATCH] Fix 'unreachable code' panic when subscription drops --- eventstore/src/commands.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/eventstore/src/commands.rs b/eventstore/src/commands.rs index b32bd319..79456343 100644 --- a/eventstore/src/commands.rs +++ b/eventstore/src/commands.rs @@ -1378,13 +1378,12 @@ impl PersistentSubscription { Err(e) } - Ok(resp) => { - if let Some(content) = resp.and_then(|r| r.content) { - return Ok(content.into()); - } - - unreachable!() - } + Ok(Some(crate::event_store::client::persistent::ReadResp { + content: Some(content), + })) => Ok(content.into()), + Ok(_) => Err(crate::Error::IllegalStateError( + "Persistent subscription returned no response".to_string(), + )), } }