Skip to content

Commit dc77416

Browse files
author
BRUNER Patrick
committed
review comment
1 parent f915cc0 commit dc77416

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/LogExpert.Core/Classes/Persister/ProjectFileValidator.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
using System.Security;
2+
13
using LogExpert.Core.Interface;
24

35
namespace LogExpert.Core.Classes.Persister;
@@ -106,7 +108,6 @@ private static bool IsUri (string fileName)
106108
/// Gets the list of fixed drive letters that are ready.
107109
/// Extracted to avoid repeated expensive DriveInfo.GetDrives() calls.
108110
/// </summary>
109-
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "Drive enumeration can fail for various reasons")]
110111
private static List<char> GetFixedDriveLetters ()
111112
{
112113
try
@@ -115,7 +116,12 @@ private static List<char> GetFixedDriveLetters ()
115116
.Where(d => d.IsReady && d.DriveType == DriveType.Fixed)
116117
.Select(d => d.Name[0])];
117118
}
118-
catch
119+
catch(Exception ex) when (
120+
ex is IOException
121+
or UnauthorizedAccessException
122+
or SecurityException
123+
or DriveNotFoundException
124+
or ArgumentNullException)
119125
{
120126
return [];
121127
}

0 commit comments

Comments
 (0)