diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2018-07-18 13:57:40 -0700 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2018-07-26 10:36:54 -0700 |
commit | aed160d035456fc0945a92e8db9b13eca2ad387e (patch) | |
tree | 6aa20b0b32d552a8443ca16d964b3fe3f421c732 /alot/ui.py | |
parent | b722b246be0663415951cde486332b04a6ebeb38 (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.py | 19 |
1 files changed, 3 insertions, 16 deletions
@@ -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') |