From 4699861925fa9201e0b65a0b761181daefbc0cd3 Mon Sep 17 00:00:00 2001 From: Florian Klien Date: Mon, 19 Nov 2018 21:55:51 +0100 Subject: [PATCH] catch http upload errors on upload --- slixmpp/plugins/xep_0363/http_upload.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/slixmpp/plugins/xep_0363/http_upload.py b/slixmpp/plugins/xep_0363/http_upload.py index 2228ca8b..79a42412 100644 --- a/slixmpp/plugins/xep_0363/http_upload.py +++ b/slixmpp/plugins/xep_0363/http_upload.py @@ -148,6 +148,8 @@ class XEP_0363(BasePlugin): data=input_file, headers=headers, timeout=timeout) + if response.status >= 400: + raise FileUploadError("could not upload file: %d (%s)" % (response.status, await response.text())) log.info('Response code: %d (%s)', response.status, await response.text()) response.close() return slot['get']['url']