Skip to content

Commit 0a2b667

Browse files
committed
Handle also UnauthorizedAccessException during initial synchronisation
1 parent bd088ed commit 0a2b667

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ private static IEnumerable<FileInfo> ProcessSubDirs(DirectoryInfo srcDirInfo, st
251251
{
252252
fileInfos = srcDirInfo.GetFiles(searchPattern, SearchOption.TopDirectoryOnly);
253253
}
254-
catch (DirectoryNotFoundException)
254+
catch (Exception ex) when (ex is DirectoryNotFoundException || ex is UnauthorizedAccessException)
255255
{
256256
//ignore exceptions due to long pathnames //TODO: find a way to handle them
257257
fileInfos = Array.Empty<FileInfo>();
@@ -269,7 +269,7 @@ private static IEnumerable<FileInfo> ProcessSubDirs(DirectoryInfo srcDirInfo, st
269269
{
270270
dirInfos = srcDirInfo.GetDirectories("*", SearchOption.TopDirectoryOnly);
271271
}
272-
catch (DirectoryNotFoundException)
272+
catch (Exception ex) when (ex is DirectoryNotFoundException || ex is UnauthorizedAccessException)
273273
{
274274
//ignore exceptions due to long pathnames //TODO: find a way to handle them
275275
dirInfos = Array.Empty<DirectoryInfo>();

0 commit comments

Comments
 (0)