core: return QubesVMNotFoundError when setting non-existent VM to VMProperty

Not sure about this one. Maybe it should be rather
QubesPropertyValueError?
This commit is contained in:
Marek Marczykowski-Górecki 2016-02-10 16:50:11 +01:00 committed by Wojtek Porczyk
parent 380ad74494
commit 843cf68c1a

View File

@ -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} '