summaryrefslogtreecommitdiff
path: root/alot
diff options
context:
space:
mode:
authorJulian Mehne <julian.mehne@posteo.de>2017-12-02 22:37:03 +0100
committerJulian Mehne <julian.mehne@posteo.de>2017-12-02 23:28:38 +0100
commit4501d073407be97fdf4206bec853ea0ec1e5351b (patch)
treea875c893af1805fe27e820e8b1a7c46e88f27230 /alot
parent94d17f5712bf48801783abfa7ce17fde2b011dfa (diff)
Inform user why :compose got cancelled.
Diffstat (limited to 'alot')
-rw-r--r--alot/commands/globals.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/alot/commands/globals.py b/alot/commands/globals.py
index 57ddfcb6..92ef3e7e 100644
--- a/alot/commands/globals.py
+++ b/alot/commands/globals.py
@@ -35,6 +35,7 @@ from ..widgets.utils import DialogBox
from ..db.errors import DatabaseLockedError
from ..db.envelope import Envelope
from ..settings.const import settings
+from ..settings.errors import NoMatchingAccount
from ..utils import argparse as cargparse
MODE = 'global'
@@ -816,7 +817,14 @@ class ComposeCommand(Command):
# find out the right account
sender = self.envelope.get('From')
name, addr = email.utils.parseaddr(sender)
- account = settings.get_account_by_address(addr)
+ try:
+ account = settings.get_account_by_address(addr)
+ except NoMatchingAccount:
+ msg = 'Cannot compose mail - no account found for `%s`' % addr
+ logging.error(msg)
+ ui.notify(msg, priority='error')
+ raise CommandCanceled()
+
if account is None:
accounts = settings.get_accounts()
if not accounts: