]> git.giacomolli.uk - onechat/blobdiff - whatsapp_inbox.go
Return known failures without redundant checks
[onechat] / whatsapp_inbox.go
index 5010a74c70c79d44b29678c500ba4ccb36acb11b..8bf8a97eaee2dfa431012a539d9af667d4829952 100644 (file)
@@ -129,7 +129,7 @@ func (i *WhatsAppInbox) deliver(ctx context.Context, l *TurnLoop, link WhatsAppL
        }
 
        if err != nil {
-               return err
+               return fmt.Errorf("close due WhatsApp batches: %w", err)
        }
 
        batches := i.state.Closed()
@@ -183,7 +183,7 @@ func (i *WhatsAppInbox) deliver(ctx context.Context, l *TurnLoop, link WhatsAppL
 
                err = i.state.Remove(batch.Number)
                if err != nil {
-                       return err
+                       return fmt.Errorf("remove delivered WhatsApp batch: %w", err)
                }
 
                if batch.Turn() {