summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--alot/ui.py13
1 files changed, 3 insertions, 10 deletions
diff --git a/alot/ui.py b/alot/ui.py
index f7efbb4e..cf44c342 100644
--- a/alot/ui.py
+++ b/alot/ui.py
@@ -459,13 +459,6 @@ class UI(object):
# call cmd.apply
logging.debug('apply command: %s' % cmd)
- try:
- retval = cmd.apply(self)
- # if we deal with a InlineCallbacks-decorated method, it
- # instantly returns a defered. This adds call/errbacks to react
- # to successful/erroneous termination of the defered apply()
- if isinstance(retval, defer.Deferred):
- retval.addErrback(errorHandler)
- retval.addCallback(call_posthook)
- except Exception, e:
- errorHandler(Failure(e))
+ d = defer.maybeDeferred(cmd.apply, self)
+ d.addErrback(errorHandler)
+ d.addCallback(call_posthook)