diff --git a/src/Firebase/Messaging.php b/src/Firebase/Messaging.php index d6f44350..9e90b851 100644 --- a/src/Firebase/Messaging.php +++ b/src/Firebase/Messaging.php @@ -58,7 +58,7 @@ public function send(Message|array $message, bool $validateOnly = false): array $token = Json::decode(Json::encode($message), true)['token'] ?? null; if ($token) { - throw NotFound::becauseTokenNotFound($token); + throw NotFound::becauseTokenNotFound($token, $e->errors()); } throw $e; @@ -189,8 +189,8 @@ public function getAppInstance(RegistrationToken|string $registrationToken): App try { return $this->appInstanceApi->getAppInstanceAsync($token)->wait(); - } catch (NotFound) { - throw NotFound::becauseTokenNotFound($token->value()); + } catch (NotFound $e) { + throw NotFound::becauseTokenNotFound($token->value(), $e->errors()); } catch (MessagingException $e) { // The token is invalid throw new InvalidArgument("The registration token '{$token}' is invalid or not available", $e->getCode(), $e);