Skip to content

Commit

Permalink
GO-2827: Use std errors.Join
Browse files Browse the repository at this point in the history
  • Loading branch information
deff7 committed Jun 12, 2024
1 parent 9ef26cf commit a9d457a
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions core/filestorage/filesync/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"github.com/anyproto/any-sync/commonfile/fileproto/fileprotoerr"
"github.com/anyproto/any-sync/commonspace/spacestorage"
"github.com/anyproto/any-sync/net/peer"
"github.com/hashicorp/go-multierror"
blocks "github.com/ipfs/go-block-format"
"github.com/ipfs/go-cid"
"github.com/samber/lo"
Expand Down Expand Up @@ -188,7 +187,7 @@ func (s *fileSync) UploadSynchronously(ctx context.Context, spaceId string, file
}

func (s *fileSync) runOnUploadedHook(fileObjectId string, fileId domain.FullFileId) error {
var merr multierror.Error
var errs error
for _, hook := range s.onUploaded {
err := hook(fileObjectId, fileId)
if err != nil {
Expand All @@ -199,10 +198,10 @@ func (s *fileSync) runOnUploadedHook(fileObjectId string, fileId domain.FullFile
zap.String("fileId", fileId.FileId.String()),
zap.Error(err))
}
merr.Errors = append(merr.Errors, err)
errs = errors.Join(errs, err)
}
}
return merr.ErrorOrNil()
return errs
}

func (s *fileSync) runOnUploadStartedHook(fileObjectId string, fileId domain.FullFileId) error {
Expand Down

0 comments on commit a9d457a

Please sign in to comment.