diff --git a/pkg/s3store/multi_error.go b/pkg/s3store/multi_error.go deleted file mode 100644 index 78fd97ece..000000000 --- a/pkg/s3store/multi_error.go +++ /dev/null @@ -1,14 +0,0 @@ -package s3store - -import ( - "errors" -) - -// TODO: Replace with errors.Join -func newMultiError(errs []error) error { - message := "Multiple errors occurred:\n" - for _, err := range errs { - message += "\t" + err.Error() + "\n" - } - return errors.New(message) -} diff --git a/pkg/s3store/s3store.go b/pkg/s3store/s3store.go index e592a6482..7b5acafff 100644 --- a/pkg/s3store/s3store.go +++ b/pkg/s3store/s3store.go @@ -826,7 +826,7 @@ func (upload s3Upload) Terminate(ctx context.Context) error { wg.Wait() if len(errs) > 0 { - return newMultiError(errs) + return errors.Join(errs...) } return nil diff --git a/pkg/s3store/s3store_test.go b/pkg/s3store/s3store_test.go index 2b3787f02..e69ba2e3f 100644 --- a/pkg/s3store/s3store_test.go +++ b/pkg/s3store/s3store_test.go @@ -1196,7 +1196,7 @@ func TestTerminateWithErrors(t *testing.T) { assert.Nil(err) err = store.AsTerminatableUpload(upload).Terminate(context.Background()) - assert.Equal("Multiple errors occurred:\n\tAWS S3 Error (hello) for object uploadId: it's me.\n", err.Error()) + assert.Equal("AWS S3 Error (hello) for object uploadId: it's me.", err.Error()) } func TestConcatUploadsUsingMultipart(t *testing.T) {