Skip to content

Commit

Permalink
Import full exceptions hierarchy
Browse files Browse the repository at this point in the history
  • Loading branch information
marmarek committed Mar 9, 2017
1 parent 484743f commit 7baa7e4
Showing 1 changed file with 73 additions and 0 deletions.
73 changes: 73 additions & 0 deletions qubesmgmt/exc.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,76 @@ def __init__(self, message_format, *args, **kwargs):
super(QubesException, self).__init__(
message_format % tuple(int(d) if d.isdigit() else d for d in args),
**kwargs)


class QubesVMNotFoundError(QubesException, KeyError):
'''Domain cannot be found in the system'''


class QubesVMError(QubesException):
'''Some problem with domain state.'''


class QubesVMNotStartedError(QubesVMError):
'''Domain is not started.
This exception is thrown when machine is halted, but should be started
(that is, either running or paused).
'''


class QubesVMNotRunningError(QubesVMNotStartedError):
'''Domain is not running.
This exception is thrown when machine should be running but is either
halted or paused.
'''


class QubesVMNotPausedError(QubesVMNotStartedError):
'''Domain is not paused.
This exception is thrown when machine should be paused, but is not.
'''


class QubesVMNotSuspendedError(QubesVMError):
'''Domain is not suspended.
This exception is thrown when machine should be suspended but is either
halted or running.
'''


class QubesVMNotHaltedError(QubesVMError):
'''Domain is not halted.
This exception is thrown when machine should be halted, but is not (either
running or paused).
'''


class QubesNoTemplateError(QubesVMError):
'''Cannot start domain, because there is no template'''


class QubesValueError(QubesException, ValueError):
'''Cannot set some value, because it is invalid, out of bounds, etc.'''
pass


class QubesPropertyValueError(QubesValueError):
'''Cannot set value of qubes.property, because user-supplied value is wrong.
'''


class QubesNotImplementedError(QubesException, NotImplementedError):
'''Thrown at user when some feature is not implemented'''


class BackupCancelledError(QubesException):
'''Thrown at user when backup was manually cancelled'''


class QubesMemoryError(QubesException, MemoryError):
'''Cannot start domain, because not enough memory is available'''

0 comments on commit 7baa7e4

Please sign in to comment.