diff options
author | Patrick Totzke <patricktotzke@gmail.com> | 2013-07-07 18:06:49 +0100 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2013-07-07 18:06:49 +0100 |
commit | 949c5b17b48ed8e45d315ba9c55d3ace1b511cb3 (patch) | |
tree | 6a767759cee801d43cc0d0c3e9b86f2d380982da /alot/addressbooks.py | |
parent | b3126fd75a4e9ad0949f54afbf4240dd5e0297df (diff) | |
parent | 330e0542b6d1e32574b4c7561982f059a0b49de8 (diff) |
Merge branch '0.3.4-fix-624'
Diffstat (limited to 'alot/addressbooks.py')
-rw-r--r-- | alot/addressbooks.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/alot/addressbooks.py b/alot/addressbooks.py index 59f093de..890eb0e3 100644 --- a/alot/addressbooks.py +++ b/alot/addressbooks.py @@ -9,6 +9,10 @@ from helper import call_cmd from alot.helper import split_commandstring +class AddressbookError(Exception): + pass + + class AddressBook(object): """can look up email addresses and realnames for contacts. @@ -89,6 +93,13 @@ class MatchSdtoutAddressbook(AddressBook): def lookup(self, prefix): cmdlist = split_commandstring(self.command) resultstring, errmsg, retval = call_cmd(cmdlist + [prefix]) + if retval != 0: + msg = 'abook command "%s" returned with ' % self.command + msg += 'return code %d' % retval + if errmsg: + msg += ':\n%s' % errmsg + raise AddressbookError(msg) + if not resultstring: return [] lines = resultstring.splitlines() |