mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-25 14:43:33 -06:00
[bugfix] Rework MultiError to wrap + unwrap errors properly (#2057)
* rework multierror a bit * test multierror
This commit is contained in:
parent
2cee8f2dd8
commit
e8a20f587c
24 changed files with 263 additions and 154 deletions
|
|
@ -117,7 +117,7 @@ func (l *listDB) GetListsForAccountID(ctx context.Context, accountID string) ([]
|
|||
func (l *listDB) PopulateList(ctx context.Context, list *gtsmodel.List) error {
|
||||
var (
|
||||
err error
|
||||
errs = make(gtserror.MultiError, 0, 2)
|
||||
errs = gtserror.NewMultiError(2)
|
||||
)
|
||||
|
||||
if list.Account == nil {
|
||||
|
|
@ -127,7 +127,7 @@ func (l *listDB) PopulateList(ctx context.Context, list *gtsmodel.List) error {
|
|||
list.AccountID,
|
||||
)
|
||||
if err != nil {
|
||||
errs.Append(fmt.Errorf("error populating list account: %w", err))
|
||||
errs.Appendf("error populating list account: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -139,11 +139,15 @@ func (l *listDB) PopulateList(ctx context.Context, list *gtsmodel.List) error {
|
|||
"", "", "", 0,
|
||||
)
|
||||
if err != nil {
|
||||
errs.Append(fmt.Errorf("error populating list entries: %w", err))
|
||||
errs.Appendf("error populating list entries: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
return errs.Combine()
|
||||
if err := errs.Combine(); err != nil {
|
||||
return gtserror.Newf("%w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (l *listDB) PutList(ctx context.Context, list *gtsmodel.List) error {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue