Skip to content

Commit 706c697

Browse files
Merge pull request #903 from krishnprakash/alert-autofix-821.12
Potential fix for code scanning alert no. 821: Generic catch clause
2 parents 40a196a + ceeb3a6 commit 706c697

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

‎csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/FeedManagerIO.cs‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,15 @@ public FeedManagerIO(ILogger logger, IRegistryProxy? registryProxy)
2727
{
2828
return new FileInfo(path).Directory?.FullName;
2929
}
30-
catch (Exception exc)
30+
catch (ArgumentException exc)
31+
{
32+
logger.LogWarning($"Failed to get directory of '{path}': {exc}");
33+
}
34+
catch (NotSupportedException exc)
35+
{
36+
logger.LogWarning($"Failed to get directory of '{path}': {exc}");
37+
}
38+
catch (PathTooLongException exc)
3139
{
3240
logger.LogWarning($"Failed to get directory of '{path}': {exc}");
3341
}

0 commit comments

Comments
 (0)