Exceptions

Error name bound exceptions

These exceptions are bound to specific dbus error names. For example, DbusFailedError is bound to org.freedesktop.DBus.Error.Failed error name.

This means if the remote object sends an error message with this error name the Python will receive this exception.

When raised in a method callback an error message will be sent back to caller.

See list of error exceptions.

New error bound exceptions

If you want to create a new error bound exception you should subclass it from DbusFailedError and provide a unique dbus_error_name attribute in the exception body definition.

Example:

class DbusExampleError(DbusFailedError):
    dbus_error_name = 'org.example.Error'

If dbus_error_name is not unique the ValueError will be raised.

Defining an exception will automatically bind incoming error message to this new exception.

Other exceptions

exception SdBusBaseError

Base exceptions for all exceptions defined in sdbus.

exception SdBusUnmappedMessageError

Message error that is unmapped.

The exceptions argument is a tuple of error name and error message.

exception SdBusLibraryError

sd-bus library returned error.

Exception message contains line number and the error name.

Error name exception list

exception DbusFailedError

Generic failure exception.

Recommended to subclass to create a new exception.

dbus_error_name: str = org.freedesktop.DBus.Error.Failed
exception DbusNoMemoryError

Remote object is out of memory.

dbus_error_name: str = org.freedesktop.DBus.Error.NoMemory
exception DbusServiceUnknownError

No service with such name exists.

Probably should only be raised by bus daemon.

dbus_error_name: str = org.freedesktop.DBus.Error.ServiceUnknown
exception DbusNameHasNoOwnerError

No process owns the name you called.

Probably should only be raised by bus daemon.

dbus_error_name: str = org.freedesktop.DBus.Error.NameHasNoOwner
exception DbusNoReplyError

Timeout on reply.

dbus_error_name: str = org.freedesktop.DBus.Error.NoReply
exception DbusIOError

Input/Output error.

dbus_error_name: str = org.freedesktop.DBus.Error.IOError
exception DbusBadAddressError

Bad address.

dbus_error_name: str = org.freedesktop.DBus.Error.BadAddress
exception DbusNotSupportedError

Something is unsupported on this platform.

dbus_error_name: str = org.freedesktop.DBus.Error.NotSupported
exception DbusLimitsExceededError

Some resource was exhausted. (for example, file descriptors)

dbus_error_name: str = org.freedesktop.DBus.Error.LimitsExceeded
exception DbusAccessDeniedError

Caller does not have enough privileges.

dbus_error_name: str = org.freedesktop.DBus.Error.AccessDenied
exception DbusAuthFailedError

Authentication failed.

dbus_error_name: str = org.freedesktop.DBus.Error.AuthFailed
exception DbusNoServerError

Unable to connect to bus.

dbus_error_name: str = org.freedesktop.DBus.Error.NoServer
exception DbusTimeoutError

Socket timeout.

This is different from DbusNoReplyError as here the connection to bus timeout not the remote object not replying.

dbus_error_name: str = org.freedesktop.DBus.Error.Timeout
exception DbusNoNetworkError

No network access.

Encountered you use Dbus over TCP or SSH.

dbus_error_name: str = org.freedesktop.DBus.Error.NoNetwork
exception DbusAddressInUseError

Address in use.

dbus_error_name: str = org.freedesktop.DBus.Error.AddressInUse
exception DbusDisconnectedError

Disconnected from bus.

dbus_error_name: str = org.freedesktop.DBus.Error.Disconnected
exception DbusInvalidArgsError

Method call args are invalid.

dbus_error_name: str = org.freedesktop.DBus.Error.InvalidArgs
exception DbusFileNotFoundError

File not found.

dbus_error_name: str = org.freedesktop.DBus.Error.FileNotFound
exception DbusFileExistsError

Generic failure exception.

Recommended to subclass to create a new exception.

dbus_error_name: str = org.freedesktop.DBus.Error.FileExists
exception DbusUnknownMethodError

Unknown dbus method.

dbus_error_name: str = org.freedesktop.DBus.Error.UnknownMethod
exception DbusUnknownObjectError

Unknown dbus object.

dbus_error_name: str = org.freedesktop.DBus.Error.UnknownObject
exception DbusUnknownInterfaceError

Unknown dbus interface.

dbus_error_name: str = org.freedesktop.DBus.Error.UnknownInterface
exception DbusUnknownPropertyError

Unknown dbus property.

dbus_error_name: str = org.freedesktop.DBus.Error.UnknownProperty
exception DbusPropertyReadOnlyError

Dbus property is read only.

dbus_error_name: str = org.freedesktop.DBus.Error.PropertyReadOnly
exception DbusUnixProcessIdUnknownError

PID does not exists.

dbus_error_name: str = org.freedesktop.DBus.Error.UnixProcessIdUnknown
exception DbusInvalidSignatureError

Invalid dbus type signature.

dbus_error_name: str = org.freedesktop.DBus.Error.InvalidSignature
exception DbusInvalidFileContentError

Invalid file content.

dbus_error_name: str = org.freedesktop.DBus.Error.InvalidFileContent
exception DbusInconsistentMessageError

Dbus message is malformed.

dbus_error_name: str = org.freedesktop.DBus.Error.InconsistentMessage
exception DbusMatchRuleNotFound

Match rule does not exist.

dbus_error_name: str = org.freedesktop.DBus.Error.MatchRuleNotFound
exception DbusMatchRuleInvalidError

Match rule is invalid.

dbus_error_name: str = org.freedesktop.DBus.Error.MatchRuleInvalid
exception DbusInteractiveAuthorizationRequiredError

Requires interactive authorization.

dbus_error_name: str = org.freedesktop.DBus.Error.InteractiveAuthorizationRequired