1
0
Fork 0
mirror of synced 2024-09-30 17:26:48 +13:00

Merge pull request #7579 from appwrite/fix-add-error-on-no-deliveries

Add unknown error is delivered total is 0 but there were no delivery …
This commit is contained in:
Jake Barnby 2024-02-15 16:45:01 +13:00 committed by GitHub
commit 217ed2bdff
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -264,7 +264,7 @@ class Messaging extends Action
}
}
} catch (\Throwable $e) {
$deliveryErrors[] = 'Failed sending to targets ' . $batchIndex + 1 . '-' . \count($batch) . ' with error: ' . $e->getMessage();
$deliveryErrors[] = 'Failed sending to targets ' . $batchIndex + 1 . ' of ' . \count($batch) . ' with error: ' . $e->getMessage();
} finally {
$batchIndex++;
@ -288,6 +288,10 @@ class Messaging extends Action
$deliveryErrors = \array_merge($deliveryErrors, $result['deliveryErrors']);
}
if (empty($deliveryErrors) && $deliveredTotal === 0) {
$deliveryErrors[] = 'Unknown error';
}
$message->setAttribute('deliveryErrors', $deliveryErrors);
if (\count($message->getAttribute('deliveryErrors')) > 0) {