summaryrefslogtreecommitdiff
path: root/alot/ui.py
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2018-07-18 13:57:40 -0700
committerDylan Baker <dylan@pnwbakers.com>2018-07-26 10:36:54 -0700
commitaed160d035456fc0945a92e8db9b13eca2ad387e (patch)
tree6aa20b0b32d552a8443ca16d964b3fe3f421c732 /alot/ui.py
parentb722b246be0663415951cde486332b04a6ebeb38 (diff)
ui: Drop unneeded _error_handler and rename _error_handler2
The "2" version was used in non-twisted contexts, now that we don't use twisted we can drop this and rename the "2" variant to the normal variant.
Diffstat (limited to 'alot/ui.py')
-rw-r--r--alot/ui.py19
1 files changed, 3 insertions, 16 deletions
diff --git a/alot/ui.py b/alot/ui.py
index 12a0d3f6..457fd078 100644
--- a/alot/ui.py
+++ b/alot/ui.py
@@ -140,20 +140,7 @@ class UI(object):
# start urwids mainloop
self.mainloop.run()
- def _error_handler(self, failure):
- """Default handler for exceptions in callbacks."""
- if failure.check(CommandParseError):
- self.notify(failure.getErrorMessage(), priority='error')
- elif failure.check(CommandCanceled):
- self.notify("operation cancelled", priority='error')
- else:
- logging.error(failure.getTraceback())
- errmsg = failure.getErrorMessage()
- if errmsg:
- msg = "{}\n(check the log for details)".format(errmsg)
- self.notify(msg, priority='error')
-
- def _error_handler2(self, exception):
+ def _error_handler(self, exception):
if isinstance(exception, CommandParseError):
self.notify(str(exception), priority='error')
elif isinstance(exception, CommandCanceled):
@@ -280,7 +267,7 @@ class UI(object):
for c in split_commandline(cmdline):
await apply_this_command(c)
except Exception as e:
- self._error_handler2(e)
+ self._error_handler(e)
@staticmethod
def _unhandled_input(key):
@@ -723,7 +710,7 @@ class UI(object):
else:
cmd.apply(self)
except Exception as e:
- self._error_handler2(e)
+ self._error_handler(e)
else:
if cmd.posthook:
logging.info('calling post-hook')