From c8f173f9249e6bf0a50e0eea3b9c14f6b4c0f384 Mon Sep 17 00:00:00 2001 From: Edward Hope-Morley Date: Mon, 9 Oct 2023 09:42:10 +0100 Subject: [PATCH] Bail if fail to mkdir or download sos --- pkg/monitor/monitor.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/monitor/monitor.go b/pkg/monitor/monitor.go index 1bf60cb..d0c5c83 100644 --- a/pkg/monitor/monitor.go +++ b/pkg/monitor/monitor.go @@ -158,13 +158,15 @@ func (m *Monitor) PollNewFiles(ctx *context.Context, duration time.Duration) { if _, err := os.Stat(basePath); os.IsNotExist(err) { log.Debugf("Temporary base path '%s' doesn't exist - creating", basePath) if err = os.MkdirAll(basePath, 0755); err != nil { - log.Errorf("Cannot create temporary base path: %s", err.Error()) + log.Errorf("Failed to create temporary base path: %s - skipping", err.Error()) + continue } } log.Debugf("Using temporary base path: %s", basePath) fileEntry, err := m.FilesClient.Download(&file, basePath) if err != nil { - log.Errorf("Failed to download %s: %s", file.Path, err) + log.Errorf("Failed to download %s: %s - skipping", file.Path, err) + continue } log.Infof("Downloaded %s", fileEntry.Path)