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:
parent
380ad74494
commit
843cf68c1a
@ -1061,9 +1061,10 @@ class VMProperty(property):
|
|||||||
|
|
||||||
app = instance if isinstance(instance, Qubes) else instance.app
|
app = instance if isinstance(instance, Qubes) else instance.app
|
||||||
|
|
||||||
# XXX this may throw LookupError; that's good until introduction
|
try:
|
||||||
# of QubesNoSuchVMException or whatever
|
vm = app.domains[value]
|
||||||
vm = app.domains[value]
|
except KeyError:
|
||||||
|
raise qubes.exc.QubesVMNotFoundError(value)
|
||||||
|
|
||||||
if not isinstance(vm, self.vmclass):
|
if not isinstance(vm, self.vmclass):
|
||||||
raise TypeError('wrong VM class: domains[{!r}] if of type {!s} '
|
raise TypeError('wrong VM class: domains[{!r}] if of type {!s} '
|
||||||
|
Loading…
Reference in New Issue
Block a user