diff --git a/src/internal/kopia/upload.go b/src/internal/kopia/upload.go index faa46cea8..302063933 100644 --- a/src/internal/kopia/upload.go +++ b/src/internal/kopia/upload.go @@ -257,6 +257,16 @@ func (cp *corsoProgress) CachedFile(fname string, size int64) { d.cached = true } +// Kopia interface function used as a callback when kopia encounters an error +// during the upload process. This could be from reading a file or something +// else. +func (cp *corsoProgress) Error(relpath string, err error, isIgnored bool) { + defer cp.UploadProgress.Error(relpath, err, isIgnored) + + cp.errs.Add(clues.Wrap(err, "kopia reported error"). + WithAll("is_ignored", isIgnored, "relative_path", relpath)) +} + func (cp *corsoProgress) put(k string, v *itemDetails) { cp.mu.Lock() defer cp.mu.Unlock() diff --git a/src/internal/kopia/wrapper_test.go b/src/internal/kopia/wrapper_test.go index 8c1505ed3..baa7a5d9b 100644 --- a/src/internal/kopia/wrapper_test.go +++ b/src/internal/kopia/wrapper_test.go @@ -483,7 +483,7 @@ func (suite *KopiaIntegrationSuite) TestBackupCollections_ReaderError() { tags, true, fault.New(true)) - require.NoError(t, err) + require.Error(t, err) assert.Equal(t, 0, stats.ErrorCount) assert.Equal(t, 5, stats.TotalFileCount)