diff options
Diffstat (limited to 'internal/db/bundb/status.go')
-rw-r--r-- | internal/db/bundb/status.go | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/internal/db/bundb/status.go b/internal/db/bundb/status.go index c34074dd6..25b773dfa 100644 --- a/internal/db/bundb/status.go +++ b/internal/db/bundb/status.go @@ -22,7 +22,6 @@ import ( "context" "database/sql" "errors" - "fmt" "time" "github.com/superseriousbusiness/gotosocial/internal/db" @@ -129,7 +128,7 @@ func (s *statusDB) getStatus(ctx context.Context, lookup string, dbQuery func(*g func (s *statusDB) PopulateStatus(ctx context.Context, status *gtsmodel.Status) error { var ( err error - errs = make(gtserror.MultiError, 0, 9) + errs = gtserror.NewMultiError(9) ) if status.Account == nil { @@ -139,7 +138,7 @@ func (s *statusDB) PopulateStatus(ctx context.Context, status *gtsmodel.Status) status.AccountID, ) if err != nil { - errs.Append(fmt.Errorf("error populating status author: %w", err)) + errs.Appendf("error populating status author: %w", err) } } @@ -150,7 +149,7 @@ func (s *statusDB) PopulateStatus(ctx context.Context, status *gtsmodel.Status) status.InReplyToID, ) if err != nil { - errs.Append(fmt.Errorf("error populating status parent: %w", err)) + errs.Appendf("error populating status parent: %w", err) } } @@ -162,7 +161,7 @@ func (s *statusDB) PopulateStatus(ctx context.Context, status *gtsmodel.Status) status.InReplyToID, ) if err != nil { - errs.Append(fmt.Errorf("error populating status parent: %w", err)) + errs.Appendf("error populating status parent: %w", err) } } @@ -173,7 +172,7 @@ func (s *statusDB) PopulateStatus(ctx context.Context, status *gtsmodel.Status) status.InReplyToAccountID, ) if err != nil { - errs.Append(fmt.Errorf("error populating status parent author: %w", err)) + errs.Appendf("error populating status parent author: %w", err) } } } @@ -186,7 +185,7 @@ func (s *statusDB) PopulateStatus(ctx context.Context, status *gtsmodel.Status) status.BoostOfID, ) if err != nil { - errs.Append(fmt.Errorf("error populating status boost: %w", err)) + errs.Appendf("error populating status boost: %w", err) } } @@ -197,7 +196,7 @@ func (s *statusDB) PopulateStatus(ctx context.Context, status *gtsmodel.Status) status.BoostOfAccountID, ) if err != nil { - errs.Append(fmt.Errorf("error populating status boost author: %w", err)) + errs.Appendf("error populating status boost author: %w", err) } } } @@ -209,7 +208,7 @@ func (s *statusDB) PopulateStatus(ctx context.Context, status *gtsmodel.Status) status.AttachmentIDs, ) if err != nil { - errs.Append(fmt.Errorf("error populating status attachments: %w", err)) + errs.Appendf("error populating status attachments: %w", err) } } @@ -220,7 +219,7 @@ func (s *statusDB) PopulateStatus(ctx context.Context, status *gtsmodel.Status) status.TagIDs, ) if err != nil { - errs.Append(fmt.Errorf("error populating status tags: %w", err)) + errs.Appendf("error populating status tags: %w", err) } } @@ -231,7 +230,7 @@ func (s *statusDB) PopulateStatus(ctx context.Context, status *gtsmodel.Status) status.MentionIDs, ) if err != nil { - errs.Append(fmt.Errorf("error populating status mentions: %w", err)) + errs.Appendf("error populating status mentions: %w", err) } } @@ -242,11 +241,15 @@ func (s *statusDB) PopulateStatus(ctx context.Context, status *gtsmodel.Status) status.EmojiIDs, ) if err != nil { - errs.Append(fmt.Errorf("error populating status emojis: %w", err)) + errs.Appendf("error populating status emojis: %w", err) } } - return errs.Combine() + if err := errs.Combine(); err != nil { + return gtserror.Newf("%w", err) + } + + return nil } func (s *statusDB) PutStatus(ctx context.Context, status *gtsmodel.Status) error { |