From 8b385a0c99f0f4c184c096ba8f01900578b1b1d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Tue, 12 May 2020 01:58:37 +0200 Subject: [PATCH] plugins/upload: handle more exceptions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maxime “pep” Buquet --- plugins/upload.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/upload.py b/plugins/upload.py index 5e6dfb04..c702dc49 100644 --- a/plugins/upload.py +++ b/plugins/upload.py @@ -24,7 +24,7 @@ import traceback from os.path import expanduser from glob import glob -from slixmpp.plugins.xep_0363.http_upload import UploadServiceNotFound +from slixmpp.plugins.xep_0363.http_upload import FileTooBig, HTTPError, UploadServiceNotFound from poezio.plugin import BasePlugin from poezio.core.structs import Completion @@ -56,6 +56,9 @@ class Plugin(BasePlugin): except UploadServiceNotFound: self.api.information('HTTP Upload service not found.', 'Error') return None + except (FileTooBig, HTTPError) as exn: + self.api.information(str(exn), 'Error') + return None except Exception: exception = traceback.format_exc() self.api.information('Failed to upload file: %s' % exception,