From c07f7f58957a04bfe116eac0f9e8f7a6cd1c1557 Mon Sep 17 00:00:00 2001 From: Michael Landis Date: Fri, 15 Mar 2024 13:13:12 -0700 Subject: [PATCH 1/2] fix: properly re-throw caught exception in eager connection code 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Momento.Sdk/CacheClient.cs b/src/Momento.Sdk/CacheClient.cs index ce448de5..30a280a6 100644 --- a/src/Momento.Sdk/CacheClient.cs +++ b/src/Momento.Sdk/CacheClient.cs @@ -58,7 +58,7 @@ public static async Task CreateAsync(IConfiguration config, ICrede catch (Exception e) { cacheClient.Dispose(); - throw e; + throw; } return cacheClient; } From 307cf635874f47b14fca352cb78dce0bf0f5a3f4 Mon Sep 17 00:00:00 2001 From: Michael Landis Date: Mon, 18 Mar 2024 10:56:03 -0700 Subject: [PATCH 2/2] chore: remove unused exception name --- src/Momento.Sdk/CacheClient.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Momento.Sdk/CacheClient.cs b/src/Momento.Sdk/CacheClient.cs index 30a280a6..8f152e1a 100644 --- a/src/Momento.Sdk/CacheClient.cs +++ b/src/Momento.Sdk/CacheClient.cs @@ -55,7 +55,7 @@ public static async Task CreateAsync(IConfiguration config, ICrede { await cacheClient.DataClient.EagerConnectAsync(eagerConnectionTimeout); } - catch (Exception e) + catch (Exception) { cacheClient.Dispose(); throw;