Skip to content

Commit 68a9bd9

Browse files
authored
Merge pull request #897 from nextcloud/backport/895/stable33
[stable33] fix: catch device not found
2 parents acfbcc0 + 0fd84e8 commit 68a9bd9

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lib/Provider/Channel/GoWhatsApp/Gateway.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -901,6 +901,15 @@ private function checkUserOnWhatsApp(string $phoneNumber): bool {
901901
);
902902
}
903903

904+
if ($status === 404 || ($data['code'] ?? '') === 'DEVICE_NOT_FOUND') {
905+
$this->eventDispatcher->dispatchTyped(new WhatsAppAuthenticationErrorEvent());
906+
907+
throw new MessageTransmissionException(
908+
$this->l10n->t('WhatsApp device not found or not connected. Please reconfigure the device.'),
909+
self::CODE_AUTHENTICATION,
910+
);
911+
}
912+
904913
if ($status === 403) {
905914
throw new MessageTransmissionException('Access to the WhatsApp API was denied (403). Check permissions or IP allowlist.', self::CODE_FORBIDDEN);
906915
}

0 commit comments

Comments
 (0)