summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2018-03-11 19:42:11 +0100
committerEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2018-03-11 19:42:42 +0100
commit507c45982de834fa584e609d87079b3bda83faf5 (patch)
tree2c06c64f4f51846e65db4d425824c90ac757e57f
parentaa3c4dea96466d413e30e4a6394c5665edf0ef9e (diff)
downloadpoezio-507c45982de834fa584e609d87079b3bda83faf5.tar.gz
poezio-507c45982de834fa584e609d87079b3bda83faf5.tar.bz2
poezio-507c45982de834fa584e609d87079b3bda83faf5.tar.xz
poezio-507c45982de834fa584e609d87079b3bda83faf5.zip
upload plugin: Don’t insert invalid URL after HTTP upload failed.
-rw-r--r--plugins/upload.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/plugins/upload.py b/plugins/upload.py
index bfdbe47b..0f9ef736 100644
--- a/plugins/upload.py
+++ b/plugins/upload.py
@@ -17,6 +17,7 @@ This plugin adds a command to the chat tabs.
"""
import asyncio
+import traceback
from os.path import expanduser
from glob import glob
@@ -41,8 +42,10 @@ class Plugin(BasePlugin):
def async_upload(self, filename):
try:
url = yield from self.core.xmpp['xep_0363'].upload_file(filename)
- except Exception as e:
- self.api.information('Failed to upload the file: %s(%s)' % (type(e), e), 'Error')
+ except Exception:
+ exception = traceback.format_exc()
+ self.api.information('Failed to upload file: %s' % exception, 'Error')
+ return
self.core.insert_input_text(url)
@command_args_parser.quoted(1)