From 010024f84b6d483371cf6b9ccb5c344a8e0c67fc Mon Sep 17 00:00:00 2001 From: Noam Meltzer Date: Sat, 20 Jan 2018 15:06:54 +0200 Subject: [PATCH] webhookhandler: Fix exception thrown during error handling BaseServer.handle_error() default behaviour is to print to stdout or stderr (depends on the python version). In case that the file descriptor is closed an additional exception will be raised, resulting with the webhook thread to quit. Fixes #970 --- telegram/utils/webhookhandler.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/telegram/utils/webhookhandler.py b/telegram/utils/webhookhandler.py index 42c45d45f29..d5b32b74420 100644 --- a/telegram/utils/webhookhandler.py +++ b/telegram/utils/webhookhandler.py @@ -62,12 +62,17 @@ def serve_forever(self, poll_interval=0.5): def shutdown(self): with self.shutdown_lock: if not self.is_running: - self.logger.warn('Webhook Server already stopped.') + self.logger.warning('Webhook Server already stopped.') return else: super(WebhookServer, self).shutdown() self.is_running = False + def handle_error(self, request, client_address): + """Handle an error gracefully.""" + self.logger.debug('Exception happened during processing of request from %s', + client_address, exc_info=True) + # WebhookHandler, process webhook calls # Based on: https://github.com/eternnoir/pyTelegramBotAPI/blob/master/ pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy