From d87c049308242cc24118f6c1a982059923161afb Mon Sep 17 00:00:00 2001 From: Cody Rose Date: Mon, 8 Jan 2024 12:24:57 -0500 Subject: [PATCH] enrich err obj --- pkg/cleantemp/cleantemp.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/cleantemp/cleantemp.go b/pkg/cleantemp/cleantemp.go index 8398427fdcb5..2abc7e6807a5 100644 --- a/pkg/cleantemp/cleantemp.go +++ b/pkg/cleantemp/cleantemp.go @@ -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)