diff --git a/Snowflake.Data/Core/CredentialManager/Infrastructure/SFCredentialManagerFileImpl.cs b/Snowflake.Data/Core/CredentialManager/Infrastructure/SFCredentialManagerFileImpl.cs index 2c7e4e8c4..89625f348 100644 --- a/Snowflake.Data/Core/CredentialManager/Infrastructure/SFCredentialManagerFileImpl.cs +++ b/Snowflake.Data/Core/CredentialManager/Infrastructure/SFCredentialManagerFileImpl.cs @@ -136,6 +136,11 @@ public string GetCredentials(string key) } } } + catch (Exception exception) + { + s_logger.Error("Failed to get credentials", exception); + throw; + } finally { ReleaseLock(); @@ -166,6 +171,11 @@ public void RemoveCredentials(string key) WriteToJsonFile(JsonConvert.SerializeObject(credentials)); } } + catch (Exception exception) + { + s_logger.Error("Failed to remove credentials", exception); + throw; + } finally { ReleaseLock(); @@ -192,6 +202,11 @@ public void SaveCredentials(string key, string token) string jsonString = JsonConvert.SerializeObject(credentials); WriteToJsonFile(jsonString); } + catch (Exception exception) + { + s_logger.Error("Failed to save credentials", exception); + throw; + } finally { ReleaseLock(); diff --git a/Snowflake.Data/Core/CredentialManager/Infrastructure/SFCredentialManagerWindowsNativeImpl.cs b/Snowflake.Data/Core/CredentialManager/Infrastructure/SFCredentialManagerWindowsNativeImpl.cs index 1d2d2a380..5e8819b9b 100644 --- a/Snowflake.Data/Core/CredentialManager/Infrastructure/SFCredentialManagerWindowsNativeImpl.cs +++ b/Snowflake.Data/Core/CredentialManager/Infrastructure/SFCredentialManagerWindowsNativeImpl.cs @@ -31,6 +31,11 @@ public string GetCredentials(string key) { success = CredRead(key, 1 /* Generic */, 0, out nCredPtr); } + catch (Exception exception) + { + s_logger.Error($"Failed to get credentials", exception); + throw; + } finally { _lock.ExitReadLock(); @@ -58,6 +63,11 @@ public void RemoveCredentials(string key) { success = CredDelete(key, 1 /* Generic */, 0); } + catch (Exception exception) + { + s_logger.Error($"Failed to remove credentials", exception); + throw; + } finally { _lock.ExitWriteLock(); @@ -89,6 +99,11 @@ public void SaveCredentials(string key, string token) { CredWrite(ref credential, 0); } + catch (Exception exception) + { + s_logger.Error($"Failed to save credentials", exception); + throw; + } finally { _lock.ExitWriteLock();