diff --git a/qubes/__init__.py b/qubes/__init__.py index b72ba98f..560388c5 100644 --- a/qubes/__init__.py +++ b/qubes/__init__.py @@ -1061,9 +1061,10 @@ class VMProperty(property): app = instance if isinstance(instance, Qubes) else instance.app - # XXX this may throw LookupError; that's good until introduction - # of QubesNoSuchVMException or whatever - vm = app.domains[value] + try: + vm = app.domains[value] + except KeyError: + raise qubes.exc.QubesVMNotFoundError(value) if not isinstance(vm, self.vmclass): raise TypeError('wrong VM class: domains[{!r}] if of type {!s} '