From 284103d3700be866d2a4312122654da7074dbcf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Sat, 13 Oct 2018 12:12:58 +0100 Subject: upload: add user friendly error when upload service not found 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, 5 insertions(+) (limited to 'plugins') diff --git a/plugins/upload.py b/plugins/upload.py index 4013243a..db8615c2 100644 --- a/plugins/upload.py +++ b/plugins/upload.py @@ -21,6 +21,8 @@ import traceback from os.path import expanduser from glob import glob +from slixmpp.plugins.xep_0363.http_upload import UploadServiceNotFound + from poezio.plugin import BasePlugin from poezio.core.structs import Completion from poezio.decorators import command_args_parser @@ -44,6 +46,9 @@ class Plugin(BasePlugin): async def async_upload(self, filename): try: url = await self.core.xmpp['xep_0363'].upload_file(filename) + except UploadServiceNotFound: + self.api.information('HTTP Upload service not found.', 'Error') + return except Exception: exception = traceback.format_exc() self.api.information('Failed to upload file: %s' % exception, -- cgit v1.2.3