From 9b99c2851ac5237373ec8615a570c9d04c867df9 Mon Sep 17 00:00:00 2001 From: jrconlin Date: Wed, 14 Mar 2018 14:38:43 -0700 Subject: [PATCH] bug: Add ClientError handler to UnregisterCommand Closes: #1154 --- autopush/webpush_server.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/autopush/webpush_server.py b/autopush/webpush_server.py index dcfd8949..c13ee02e 100644 --- a/autopush/webpush_server.py +++ b/autopush/webpush_server.py @@ -671,8 +671,17 @@ def process(self, message = Message(command.message_month, boto_resource=self.db.resource) - # TODO: JSONResponseError not handled (no force_retry) - message.unregister_channel(command.uaid.hex, command.channel_id) + try: + message.unregister_channel(command.uaid.hex, command.channel_id) + except ClientError as ex: # pragma: nocover + # Since this operates in a separate thread than the tests, + # we can't mock out the unregister_channel call inside + # test_webpush_server, thus the # nocover. + log.error("Unregister failed", + channel_id=command.channel_id, + uaid_hash=hasher(command.uaid.hex), + exeption=ex) + return UnregisterErrorResponse(error_msg="Unregister failed") # TODO: Clear out any existing tracked messages for this channel