Use Tobi's style for wrapping errors

This commit is contained in:
Vyr Cossont 2025-01-20 22:26:03 -08:00
commit 4f39da77bb
5 changed files with 20 additions and 26 deletions

View file

@ -41,9 +41,8 @@ func (p *Processor) CreateOrReplace(
// Clear any previous subscription.
if err := p.state.DB.DeleteWebPushSubscriptionByTokenID(ctx, tokenID); err != nil {
return nil, gtserror.NewErrorInternalError(
gtserror.Newf("couldn't delete Web Push subscription for token ID %s: %w", tokenID, err),
)
err := gtserror.Newf("couldn't delete Web Push subscription for token ID %s: %w", tokenID, err)
return nil, gtserror.NewErrorInternalError(err)
}
// Insert a new one.
@ -58,9 +57,8 @@ func (p *Processor) CreateOrReplace(
}
if err := p.state.DB.PutWebPushSubscription(ctx, subscription); err != nil {
return nil, gtserror.NewErrorInternalError(
gtserror.Newf("couldn't create Web Push subscription for token ID %s: %w", tokenID, err),
)
err := gtserror.Newf("couldn't create Web Push subscription for token ID %s: %w", tokenID, err)
return nil, gtserror.NewErrorInternalError(err)
}
return p.apiSubscription(ctx, subscription)