Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,13 @@ private bool TryGetCleanupFileDirectory(ProcessRequest processRequest, out strin
var (files, directories) = this.DirectoryUtilityService.GetFilesAndDirectories(root, patterns, depth);
return (true, files, directories);
}
catch (UnauthorizedAccessException e)
catch (Exception e) when (e is IOException or UnauthorizedAccessException)
Comment thread
mpysson marked this conversation as resolved.
Resolved
{
// log and return false if we are unauthorized to get files and directories
this.Logger.LogDebug(e, "Unauthorized to get files and directories for {Root}", root);
this.Logger.LogDebug(
"Failed to get files and directories for {Root}. Skipping cleanup. {ExceptionType}: {Message}",
root,
e.GetType().Name,
e.Message);
return (false, new HashSet<string>(), new HashSet<string>());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,18 @@ protected override async Task OnFileFoundAsync(ProcessRequest processRequest, ID
{
if (reportFile is not null && reportFile.Exists)
{
reportFile.Delete();
try
{
reportFile.Delete();
}
catch (Exception e) when (e is IOException or UnauthorizedAccessException)
Comment thread
mpysson marked this conversation as resolved.
Resolved
{
this.Logger.LogDebug(
"PipReport: Failed to delete report file {File}. {ExceptionType}: {Message}",
reportFile.FullName,
e.GetType().Name,
e.Message);
}
}
}
}
Expand Down
Loading