Skip to content

Commit

Permalink
Wrap temp deletion err #2277
Browse files Browse the repository at this point in the history
  • Loading branch information
rosecodym committed Jan 8, 2024
1 parent 6b8573d commit fd8e5e9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/cleantemp/cleantemp.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,14 @@ func CleanTempArtifacts(ctx logContext.Context) error {

if shouldDelete {
path := filepath.Join(tempDir, entry.Name())
if entry.IsDir() {
isDir := entry.IsDir()
if isDir {
err = os.RemoveAll(path)
} else {
err = os.Remove(path)
}
if err != nil {
return fmt.Errorf("error deleting temp artifact: %s", path)
return fmt.Errorf("error deleting temp artifact (dir: %v) %s: %w", isDir, path, err)
}

ctx.Logger().V(4).Info("Deleted orphaned temp artifact", "artifact", path)
Expand Down

0 comments on commit fd8e5e9

Please sign in to comment.