catch http upload errors on upload

This commit is contained in:
Florian Klien 2018-11-19 21:55:51 +01:00 committed by Emmanuel Gil Peyrot
parent 570e653ac2
commit 4699861925

View file

@ -148,6 +148,8 @@ class XEP_0363(BasePlugin):
data=input_file, data=input_file,
headers=headers, headers=headers,
timeout=timeout) 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()) log.info('Response code: %d (%s)', response.status, await response.text())
response.close() response.close()
return slot['get']['url'] return slot['get']['url']