mirror of
https://github.com/appwrite/appwrite
synced 2026-05-24 09:28:40 +00:00
Set failed and delivery errors for failure cases
This commit is contained in:
parent
0ffe1d5346
commit
aee1d44062
1 changed files with 12 additions and 4 deletions
|
|
@ -127,8 +127,12 @@ class Messaging extends Action
|
|||
}
|
||||
|
||||
if (empty($recipients)) {
|
||||
Console::error('No valid recipients found.');
|
||||
return;
|
||||
$dbForProject->updateDocument('messages', $message->getId(), $message->setAttributes([
|
||||
'status' => 'failed',
|
||||
'deliveryErrors' => ['No valid recipients found.']
|
||||
]));
|
||||
|
||||
throw new \Exception('No valid recipients found.');
|
||||
}
|
||||
|
||||
$fallback = $dbForProject->findOne('providers', [
|
||||
|
|
@ -137,8 +141,12 @@ class Messaging extends Action
|
|||
]);
|
||||
|
||||
if ($fallback === false || $fallback->isEmpty()) {
|
||||
Console::error('No fallback provider found.');
|
||||
return;
|
||||
$dbForProject->updateDocument('messages', $message->getId(), $message->setAttributes([
|
||||
'status' => 'failed',
|
||||
'deliveryErrors' => ['No fallback provider found.']
|
||||
]));
|
||||
|
||||
throw new \Exception('No fallback provider found.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue