diff options
-rw-r--r-- | alot/completion.py | 8 | ||||
-rw-r--r-- | alot/errors.py | 4 |
2 files changed, 10 insertions, 2 deletions
diff --git a/alot/completion.py b/alot/completion.py index fd3bee52..9be62e3f 100644 --- a/alot/completion.py +++ b/alot/completion.py @@ -13,7 +13,8 @@ from alot.buffers import EnvelopeBuffer from alot.settings import settings from alot.utils.booleanaction import BooleanAction from alot.helper import split_commandline - +from alot.addressbooks import AddressbookError +from errors import CompletionError class Completer(object): """base class for completers""" @@ -212,7 +213,10 @@ class AbooksCompleter(Completer): prefix = original[:pos] res = [] for abook in self.abooks: - res = res + abook.lookup(prefix) + try: + res = res + abook.lookup(prefix) + except AddressbookError as e: + raise CompletionError(e) if self.addressesonly: returnlist = [(email, len(email)) for (name, email) in res] else: diff --git a/alot/errors.py b/alot/errors.py index 435a4bf9..9f4bd519 100644 --- a/alot/errors.py +++ b/alot/errors.py @@ -20,3 +20,7 @@ class GPGProblem(Exception): def __init__(self, message, code): self.code = code super(GPGProblem, self).__init__(message) + + +class CompletionError(Exception): + pass |