summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--slixmpp/plugins/xep_0363/http_upload.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/slixmpp/plugins/xep_0363/http_upload.py b/slixmpp/plugins/xep_0363/http_upload.py
index 2228ca8b..266fc656 100644
--- a/slixmpp/plugins/xep_0363/http_upload.py
+++ b/slixmpp/plugins/xep_0363/http_upload.py
@@ -30,6 +30,10 @@ class UploadServiceNotFound(FileUploadError):
class FileTooBig(FileUploadError):
pass
+class HTTPError(FileUploadError):
+ def __str__(self):
+ return 'Could not upload file: %d (%s)' % (self.args[0], self.args[1])
+
class XEP_0363(BasePlugin):
''' This plugin only supports Python 3.5+ '''
@@ -148,6 +152,8 @@ class XEP_0363(BasePlugin):
data=input_file,
headers=headers,
timeout=timeout)
+ if response.status >= 400:
+ raise HTTPError(response.status, await response.text())
log.info('Response code: %d (%s)', response.status, await response.text())
response.close()
return slot['get']['url']