From c1ce272d4939910b65c8ba51aeee7ab2dd857d4a Mon Sep 17 00:00:00 2001 From: Michael Landis Date: Mon, 18 Mar 2024 11:07:22 -0700 Subject: [PATCH] fix: properly re-throw caught exception in eager connection code (#550) To preserve the original stack trace, one needs to use a throw; statement, not re-throw the original exception. See https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/statements/exception-handling-statements --- src/Momento.Sdk/CacheClient.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Momento.Sdk/CacheClient.cs b/src/Momento.Sdk/CacheClient.cs index ce448de5..8f152e1a 100644 --- a/src/Momento.Sdk/CacheClient.cs +++ b/src/Momento.Sdk/CacheClient.cs @@ -55,10 +55,10 @@ public static async Task CreateAsync(IConfiguration config, ICrede { await cacheClient.DataClient.EagerConnectAsync(eagerConnectionTimeout); } - catch (Exception e) + catch (Exception) { cacheClient.Dispose(); - throw e; + throw; } return cacheClient; }