Skip to content

Commit 357437e

Browse files
Copilotalerickson
andcommitted
Add cleanup error handling in Reset method instead of ignoring exceptions
Co-authored-by: alerickson <25858831+alerickson@users.noreply.github.com>
1 parent a2c0ca2 commit 357437e

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/code/RepositorySettings.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -922,9 +922,10 @@ public static PSRepositoryInfo Reset(PSCmdlet cmdletPassedIn, out string errorMs
922922
{
923923
File.Delete(tempFilePath);
924924
}
925-
catch
925+
catch (Exception cleanupEx)
926926
{
927-
// Ignore cleanup errors
927+
errorMsg = string.Format(CultureInfo.InvariantCulture, "Repository store reset failed with error: {0}. Additionally, cleanup of temporary file failed with error: {1}", e.Message, cleanupEx.Message);
928+
return null;
928929
}
929930
}
930931

0 commit comments

Comments
 (0)