Skip to content

Commit dc5b1d8

Browse files
committed
Merge remote-tracking branch 'origin/feat-improve-error-handling' into fix-multicast
2 parents 8e318cd + a0e4c09 commit dc5b1d8

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/Utopia/Messaging/Adapter/Push.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ abstract class Push extends Adapter
99
{
1010
protected const TYPE = 'push';
1111
protected const MESSAGE_TYPE = PushMessage::class;
12-
protected const EXPIRED_MESSAGE = 'Expired device token.';
12+
protected const EXPIRED_MESSAGE = 'Expired device token';
1313

1414
public function getType(): string
1515
{

src/Utopia/Messaging/Adapter/Push/FCM.php

+5-4
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,11 @@ protected function process(PushMessage $message): array
144144
$response->incrementDeliveredTo();
145145
$response->addResultForRecipient($message->getTo()[$index]);
146146
} else {
147-
$error = ($result['response']['error']['status'] ?? '') === 'UNREGISTERED' ||
148-
($result['response']['error']['status'] ?? '') === 'INVALID_ARGUMENT'
149-
? $this->getExpiredErrorMessage()
150-
: $result['response']['error']['message'] ?? 'Unknown error';
147+
$error =
148+
($result['response']['error']['status'] ?? null) === 'UNREGISTERED'
149+
|| ($result['response']['error']['status'] ?? null) === 'NOT_FOUND'
150+
? $this->getExpiredErrorMessage()
151+
: $result['response']['error']['message'] ?? 'Unknown error';
151152

152153
$response->addResultForRecipient($message->getTo()[$index], $error);
153154
}

0 commit comments

Comments
 (0)