From 63dc98b07b0728e3399a1f130acefd4746ef5e90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Sat, 23 Feb 2019 18:29:54 +0000 Subject: [PATCH] example-bot: Add catchall except in decryption and encryption MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maxime “pep” Buquet --- examples/echo_client.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/examples/echo_client.py b/examples/echo_client.py index ded07cd..9e07a43 100644 --- a/examples/echo_client.py +++ b/examples/echo_client.py @@ -125,6 +125,9 @@ class EchoBot(ClientXMPP): # resolve. At this point you should have seen other exceptions # and given a chance to resolve them already. await self.plain_reply(msg, 'I was not able to decrypt the message.') + except (Exception,) as exn: + await self.plain_reply(msg, 'An error occured while attempting decryption.\n%r' % exn) + raise return None @@ -163,7 +166,11 @@ class EchoBot(ClientXMPP): # This is where you prompt your user to ask what to do. self['xep_0384'].trust(exn.bare_jid, exn.device, exn.ik) except Exception as exn: - break + await self.plain_reply( + original_msg, + 'An error occured while attempting to encrypt.\n%r' % exn, + ) + raise return None