summaryrefslogtreecommitdiff
path: root/alot/commands/globals.py
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2018-07-27 09:38:29 -0700
committerPatrick Totzke <patricktotzke@gmail.com>2019-05-11 17:37:57 +0100
commit7d4301db08fb9576aacceb5a283cc68666b2b8db (patch)
tree1d2eca4869460ef7b1f7d54e322d1e01d3e4722b /alot/commands/globals.py
parentebf76e745b05bdaa7e44c2bf997e7671501c8c00 (diff)
commands/globals: wrap apply in an error handler
As we split the apply method up into separate methods we need a way for those helpers to stop execution of the method. This wraps the real apply method inside of a try/except block with a custom exception. Any helper that is intended to run in the apply method simply needs to raise this exception, and apply will return.
Diffstat (limited to 'alot/commands/globals.py')
-rw-r--r--alot/commands/globals.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/alot/commands/globals.py b/alot/commands/globals.py
index cd2e9512..391f0913 100644
--- a/alot/commands/globals.py
+++ b/alot/commands/globals.py
@@ -779,7 +779,16 @@ class ComposeCommand(Command):
self.encrypt = encrypt
self.tags = tags
+ class ApplyError(Exception):
+ pass
+
async def apply(self, ui):
+ try:
+ await self.__apply(ui)
+ except self.ApplyError:
+ return
+
+ async def __apply(self, ui):
if self.envelope is None:
if self.rest:
if self.rest.startswith('mailto'):