qubes.exc – Exceptions¶
As most of the modern programming languages, Python has exceptions, which can be
thrown (raised) when something goes bad. What exactly means “bad” depends
on several circumstances.
One of those circumstances is who exactly is to blame: programmer or user? Some errors are commited by programmer and will most probably result it program failure. But most errors are caused by the user, notably by specifying invalid commands or data input. Those errors should not result in failure, but fault and be handled gracefuly. One more time, what “gracefuly” means depends on specific program and its interface (for example GUI programs should most likely display some admonition, but will not crash).
In Qubes we have special exception class, qubes.exc.QubesException,
which is dedicated to handling user-caused problems. Programmer errors should
not result in raising QubesException, but it should instead result in one of the
standard Python exception. QubesExceptions should have a nice message that can
be shown to the user. On the other hand, some children classes of QubesException
also inherit from children of StandardException to allow uniform
except clauses.
Often the error relates to some domain, because we expect it to be in certain
state, but it is not. For example to start a machine, it should be halted. For
that we have the children of the qubes.exc.QubesVMError class. They
all take the domain in question as their first argument and an (optional)
message as the second. If not specified, there is stock message which is
generally informative enough.
On writing error messages¶
As a general rule, error messages should be short but precise. They should not blame user for error, but the user should know, what had been done wrong and what to do next.
If possible, write the message that is stating the fact, for example “Domain is not running” instead of “You forgot to start the domain” (you fool!). Avoid commanding user, like “Start the domain first” (user is not a function you can call for effect). Instead consider writing in negative form, implying expected state: “Domain is not running” instead of “Domain is paused” (yeah, what’s wrong with that?).
Also avoid implying the personhood of the computer, including addressing user in second person. For example, write “Sending message failed” instead of “I failed to send the message”.
Inheritance diagram¶

Module contents¶
Qubes OS exception hierarchy
- exception qubes.exc.BackupAlreadyRunningError(msg=None)[source]¶
Bases:
QubesExceptionThrown at user when they try to run the same backup twice at the same time
- exception qubes.exc.BackupCancelledError(msg=None)[source]¶
Bases:
QubesExceptionThrown at user when backup was manually cancelled
- exception qubes.exc.DeviceAlreadyAssigned[source]¶
Bases:
QubesException,KeyErrorTrying to assign already assigned device.
- exception qubes.exc.DeviceAlreadyAttached[source]¶
Bases:
QubesException,KeyErrorTrying to attach already attached device.
- exception qubes.exc.DeviceNotAssigned[source]¶
Bases:
QubesException,KeyErrorTrying to unassign not assigned device.
- exception qubes.exc.DeviceNotFound[source]¶
Bases:
QubesException,KeyErrorNon-existing device.
- exception qubes.exc.PermissionDenied[source]¶
Bases:
PermissionErrorRaised deliberately by handlers to inform the request is prohibited.
The request is valid, but the client does not have permission to perform the operation. Clients in dom0 should usually not get this error. It must only be raised by “admin-permission” events. In HTTP, this would be 403 Forbidden.
- exception qubes.exc.ProtocolError[source]¶
Bases:
AssertionErrorRaised deliberately by handlers to indicate a malformed client request.
Client programming errors. The client made a request that it should have known better than to send in the first place. Includes things like passing an argument or payload to a service documented to not take one. The only way that a correctly behaving client can get ProtocolError is qubesd is either buggy or too old. In HTTP, this would be 400 Bad Request.
It should not be used to reject requests that are valid, but which qubesd is refusing to process. Instead, raise a subclass of
QubesExceptionwith a useful error message.
- exception qubes.exc.QubesBackupProfileNotFoundError(msg=None, profile=None)[source]¶
Bases:
QubesExceptionRequested backup profile does not exist.
- exception qubes.exc.QubesException[source]¶
Bases:
ExceptionException that can be shown to the user
- exception qubes.exc.QubesFeatureNotFoundError(domain, feature)[source]¶
Bases:
QubesException,KeyErrorFeature not set for a given domain
- exception qubes.exc.QubesInvalidLabelError[source]¶
Bases:
ProtocolErrorDomain label is invalid.
- exception qubes.exc.QubesInvalidLabelValueError[source]¶
Bases:
ProtocolErrorDomain label value is invalid.
- exception qubes.exc.QubesInvalidTagError[source]¶
Bases:
ProtocolErrorDomain tag is invalid.
- exception qubes.exc.QubesLabelInUseError(label, msg=None)[source]¶
Bases:
QubesExceptionCannot remove or add label as it is still in use.
- exception qubes.exc.QubesLabelNotFoundError(label)[source]¶
Bases:
QubesException,KeyErrorLabel does not exists
- exception qubes.exc.QubesMemoryError(vm, msg=None)[source]¶
Bases:
QubesVMError,MemoryErrorCannot start domain, because not enough memory is available
- exception qubes.exc.QubesNoSuchPropertyError(holder, prop_name, msg=None)[source]¶
Bases:
QubesException,AttributeErrorRequested property does not exist
- exception qubes.exc.QubesNoTemplateError(vm, msg=None)[source]¶
Bases:
QubesVMErrorCannot start domain, because there is no template
- exception qubes.exc.QubesNotImplementedError(msg=None)[source]¶
Bases:
QubesException,NotImplementedErrorThrown at user when some feature is not implemented
- exception qubes.exc.QubesPoolInUseError(pool_name, msg=None)[source]¶
Bases:
QubesExceptionVM is in use, cannot remove.
- exception qubes.exc.QubesPropertyValueError(holder, prop, value, msg=None)[source]¶
Bases:
QubesValueErrorCannot set value of qubes.property, because user-supplied value is wrong.
- exception qubes.exc.QubesTagNotFoundError(domain, tag)[source]¶
Bases:
QubesException,KeyErrorTag not set for a given domain
- exception qubes.exc.QubesUnrecognizedDeviceAssignmentMode[source]¶
Bases:
ProtocolErrorDevice assignment is not as expected.
- exception qubes.exc.QubesVMAlreadyExistsError[source]¶
Bases:
QubesExceptionDomain was requested to be created, but it already exists.
- exception qubes.exc.QubesVMCancelledPauseError(vm, msg=None)[source]¶
Bases:
QubesVMErrorCancelled pause during domain-pre-paused event.
This exception is thrown when machine should skip pause as it doesn’t make sense to pause anymore.
- exception qubes.exc.QubesVMError(vm, msg)[source]¶
Bases:
QubesExceptionSome problem with domain state.
- exception qubes.exc.QubesVMInUseError(vm, msg=None)[source]¶
Bases:
QubesVMErrorVM is in use, cannot remove.
- exception qubes.exc.QubesVMInvalidUUIDError(uuid: str)[source]¶
Bases:
QubesExceptionDomain UUID is invalid
- exception qubes.exc.QubesVMNotFoundError(vmname)[source]¶
Bases:
QubesException,KeyErrorDomain cannot be found in the system
- exception qubes.exc.QubesVMNotHaltedError(vm, msg=None)[source]¶
Bases:
QubesVMErrorDomain is not halted.
This exception is thrown when machine should be halted, but is not (either running or paused).
- exception qubes.exc.QubesVMNotPausedError(vm, msg=None)[source]¶
Bases:
QubesVMNotStartedErrorDomain is not paused.
This exception is thrown when machine should be paused, but is not.
- exception qubes.exc.QubesVMNotRunningError(vm, msg=None)[source]¶
Bases:
QubesVMNotStartedErrorDomain is not running.
This exception is thrown when machine should be running but is either halted or paused.
- exception qubes.exc.QubesVMNotStartedError(vm, msg=None)[source]¶
Bases:
QubesVMErrorDomain is not started.
This exception is thrown when machine is halted, but should be started (that is, either running or paused).
- exception qubes.exc.QubesVMNotSuspendedError(vm, msg=None)[source]¶
Bases:
QubesVMErrorDomain is not suspended.
This exception is thrown when machine should be suspended but is either halted or running.
- exception qubes.exc.QubesVMShutdownTimeoutError(vm, msg=None)[source]¶
Bases:
QubesVMErrorDomain shutdown timed out.
- exception qubes.exc.QubesValueError[source]¶
Bases:
QubesException,ValueErrorCannot set some value, because it is invalid, out of bounds, etc.
- exception qubes.exc.QubesVolumeCopyInUseError(vm, volume, msg=None)[source]¶
Bases:
QubesExceptionDomain volume is already being cloned.
- exception qubes.exc.QubesVolumeCopyTokenNotFoundError(msg=None)[source]¶
Bases:
ProtocolError,KeyErrorDomain volume copy did not specify a configured token.
- exception qubes.exc.QubesVolumeRevisionNotFoundError[source]¶
Bases:
KeyErrorSpecified revision not found in qube volume.
- exception qubes.exc.StoragePoolException[source]¶
Bases:
QubesExceptionA general storage exception
- exception qubes.exc.UnexpectedDeviceProperty[source]¶
Bases:
QubesException,ValueErrorDevice has unexpected property such as backend_domain, devclass etc.
- exception qubes.exc.UnrecognizedDevice[source]¶
Bases:
QubesException,ValueErrorDevice identity is not as expected.