Skip to content

Commit d6bd5b1

Browse files
rjmholtTylerLeonhardt
authored andcommitted
Handle arbitrary exceptions when recursing workspace (#862)
1 parent 79dbd37 commit d6bd5b1

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/PowerShellEditorServices/Workspace/Workspace.cs

+17
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,14 @@ private void RecursivelyEnumerateFiles(string folderPath, ref List<string> found
345345

346346
continue;
347347
}
348+
catch (Exception e)
349+
{
350+
this.logger.WriteHandledException(
351+
$"Could not enumerate files in the path '{folderPath}' due to an exception",
352+
e);
353+
354+
continue;
355+
}
348356

349357
foundFiles.AddRange(psFiles);
350358
}
@@ -386,6 +394,15 @@ private void RecursivelyEnumerateFiles(string folderPath, ref List<string> found
386394

387395
return;
388396
}
397+
catch (Exception e)
398+
{
399+
this.logger.WriteHandledException(
400+
$"Could not enumerate directories in the path '{folderPath}' due to an exception",
401+
e);
402+
403+
return;
404+
}
405+
389406

390407
foreach (string subDir in subDirs)
391408
{

0 commit comments

Comments
 (0)