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:05:18 +01:00
parent 9f5ac8d389
commit 1b53de8365
No known key found for this signature in database
GPG Key ID: 9A752C30B26FD04B

View File

@ -33,6 +33,10 @@ class QubesException(Exception):
class QubesVMNotFoundError(QubesException, KeyError): class QubesVMNotFoundError(QubesException, KeyError):
'''Domain cannot be found in the system''' '''Domain cannot be found in the system'''
def __str__(self):
# KeyError overrides __str__ method
return QubesException.__str__(self)
class QubesVMError(QubesException): class QubesVMError(QubesException):
'''Some problem with domain state.''' '''Some problem with domain state.'''
@ -122,10 +126,16 @@ class QubesMemoryError(QubesException, MemoryError):
class QubesFeatureNotFoundError(QubesException, KeyError): class QubesFeatureNotFoundError(QubesException, KeyError):
'''Feature not set for a given domain''' '''Feature not set for a given domain'''
def __str__(self):
# KeyError overrides __str__ method
return QubesException.__str__(self)
class QubesTagNotFoundError(QubesException, KeyError): class QubesTagNotFoundError(QubesException, KeyError):
'''Tag not set for a given domain''' '''Tag not set for a given domain'''
def __str__(self):
# KeyError overrides __str__ method
return QubesException.__str__(self)
class StoragePoolException(QubesException): class StoragePoolException(QubesException):
@ -139,6 +149,9 @@ class QubesDaemonCommunicationError(QubesException, IOError):
class DeviceAlreadyAttached(QubesException, KeyError): class DeviceAlreadyAttached(QubesException, KeyError):
'''Trying to attach already attached device''' '''Trying to attach already attached device'''
def __str__(self):
# KeyError overrides __str__ method
return QubesException.__str__(self)
# pylint: disable=too-many-ancestors # pylint: disable=too-many-ancestors