summaryrefslogtreecommitdiff
path: root/src/tabs.py
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2013-03-16 12:16:11 +0100
committerFlorent Le Coz <louiz@louiz.org>2013-03-16 12:16:11 +0100
commitbbe041fd58812e237f38cc0a202423f5f4d9957f (patch)
tree49c98ca11c33dbf68d5bd38da8ea9dd5a2c47c98 /src/tabs.py
parentad04d32b485700fa4bff3f1be1bf0440e99a1193 (diff)
downloadpoezio-bbe041fd58812e237f38cc0a202423f5f4d9957f.tar.gz
poezio-bbe041fd58812e237f38cc0a202423f5f4d9957f.tar.bz2
poezio-bbe041fd58812e237f38cc0a202423f5f4d9957f.tar.xz
poezio-bbe041fd58812e237f38cc0a202423f5f4d9957f.zip
Catch CorrectionError to avoid tracebacking when /correct fails
Diffstat (limited to 'src/tabs.py')
-rw-r--r--src/tabs.py28
1 files changed, 18 insertions, 10 deletions
diff --git a/src/tabs.py b/src/tabs.py
index 6cd3be86..171998fd 100644
--- a/src/tabs.py
+++ b/src/tabs.py
@@ -495,11 +495,15 @@ class ChatTab(Tab):
def modify_message(self, txt, old_id, new_id, user=None):
self.log_message(txt, time, self.name)
- message = self._text_buffer.modify_message(txt, old_id, new_id, time=time, user=user)
- if message:
- self.text_win.modify_message(old_id, message)
- self.core.refresh_window()
- return True
+ try:
+ message = self._text_buffer.modify_message(txt, old_id, new_id, time=time, user=user)
+ except CorrectionError as e:
+ self.core.information("%s" % (e,), 'Error')
+ else:
+ if message:
+ self.text_win.modify_message(old_id, message)
+ self.core.refresh_window()
+ return True
return False
def last_words_completion(self):
@@ -1765,11 +1769,15 @@ class MucTab(ChatTab):
def modify_message(self, txt, old_id, new_id, time=None, nickname=None, user=None):
self.log_message(txt, time, nickname)
highlight = self.do_highlight(txt, time, nickname)
- message = self._text_buffer.modify_message(txt, old_id, new_id, highlight=highlight, time=time, user=user)
- if message:
- self.text_win.modify_message(old_id, message)
- self.core.refresh_window()
- return highlight
+ try:
+ message = self._text_buffer.modify_message(txt, old_id, new_id, highlight=highlight, time=time, user=user)
+ except CorrectionError as e:
+ self.core.information("%s" % (e,), 'Error')
+ else:
+ if message:
+ self.text_win.modify_message(old_id, message)
+ self.core.refresh_window()
+ return highlight
return False
def matching_names(self):