Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitef3df52

Browse files
committed
bug#47626 [Notifier] [Expo] Throw exception on error-response from expo api (sdrewergutland)
This PR was squashed before being merged into the 5.4 branch.Discussion----------[Notifier] [Expo] Throw exception on error-response from expo api| Q | A| ------------- | ---| Branch? | 5.4| Bug fix? | yes| New feature? | no| Deprecations? | no| Tickets | -| License | MIT| Doc PR | -Throw an actual `TransportException`in the case that an error is returned in the response from expo api.Commits-------90638ac [Notifier] [Expo] Throw exception on error-response from expo api
2 parents7dc9d04 +90638ac commitef3df52

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

‎src/Symfony/Component/Notifier/Bridge/Expo/ExpoTransport.php‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ public function supports(MessageInterface $message): bool
5050
return$messageinstanceof PushMessage;
5151
}
5252

53+
/**
54+
* @see https://docs.expo.dev/push-notifications/sending-notifications/#http2-api
55+
*/
5356
protectedfunctiondoSend(MessageInterface$message):SentMessage
5457
{
5558
if (!$messageinstanceof PushMessage) {
@@ -91,10 +94,14 @@ protected function doSend(MessageInterface $message): SentMessage
9194
thrownewTransportException('Unable to post the Expo message:'.$errorMessage,$response);
9295
}
9396

94-
$success =$response->toArray(false);
97+
$result =$response->toArray(false);
98+
99+
if ('error' ===$result['data']['status']) {
100+
thrownewTransportException(sprintf('Unable to post the Expo message: "%s" (%s)',$result['data']['message'],$result['data']['details']['error']),$response);
101+
}
95102

96103
$sentMessage =newSentMessage($message, (string)$this);
97-
$sentMessage->setMessageId($success['data']['id']);
104+
$sentMessage->setMessageId($result['data']['id']);
98105

99106
return$sentMessage;
100107
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp