Fixed Exceptions inferiting from KeyError

Due to strangeness of KeyError (it overrrides __str__ method) in some
cases exceptions received superflous quotation marks when inheriting
from it.

fixes QubesOS/qubes-issues#5106
This commit is contained in:
Marta Marczykowska-Górecka 2019-12-09 21:02:24 +01:00
parent 22ff30ee4b
commit 35fa733a67
No known key found for this signature in database
GPG Key ID: 9A752C30B26FD04B

View File

@ -33,6 +33,10 @@ class QubesVMNotFoundError(QubesException, KeyError):
'No such domain: {!r}'.format(vmname))
self.vmname = vmname
def __str__(self):
# KeyError overrides __str__ method
return QubesException.__str__(self)
class QubesVMError(QubesException):
'''Some problem with domain state.'''
@ -187,6 +191,11 @@ class QubesFeatureNotFoundError(QubesException, KeyError):
self.feature = feature
self.vm = domain
def __str__(self):
# KeyError overrides __str__ method
return QubesException.__str__(self)
class QubesTagNotFoundError(QubesException, KeyError):
'''Tag not set for a given domain'''
@ -195,3 +204,7 @@ class QubesTagNotFoundError(QubesException, KeyError):
domain, tag))
self.vm = domain
self.tag = tag
def __str__(self):
# KeyError overrides __str__ method
return QubesException.__str__(self)