mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 13:33:24 +00:00
push_notifs: Gracefully handle exception when server cant push.
The problem was that earlier this was just an uncaught JsonableError, leading to a full traceback getting spammed to the admins. The prior commit introduced a clear .code for this error on the bouncer side, meaning the self-hosted server can now detect that and handle it nicely, by just logging.error about it and also take the opportunity to adjust the realm.push_notifications_... flags.
This commit is contained in:
committed by
Tim Abbott
parent
3bda31c48c
commit
5672595c2a
@@ -185,6 +185,10 @@ def send_to_push_bouncer(
|
||||
raise PushNotificationBouncerError(
|
||||
_("Push notifications bouncer error: {error}").format(error=msg)
|
||||
)
|
||||
elif "code" in result_dict and result_dict["code"] == "PUSH_NOTIFICATIONS_DISALLOWED":
|
||||
from zerver.lib.push_notifications import PushNotificationsDisallowedByBouncerError
|
||||
|
||||
raise PushNotificationsDisallowedByBouncerError(reason=msg)
|
||||
elif (
|
||||
endpoint == "push/test_notification"
|
||||
and "code" in result_dict
|
||||
|
||||
Reference in New Issue
Block a user