Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QDBusError Class Reference

\inmodule QtDBus More...

#include <qdbuserror.h>

+ Collaboration diagram for QDBusError:

Public Types

enum  ErrorType {
  NoError = 0 , Other = 1 , Failed , NoMemory ,
  ServiceUnknown , NoReply , BadAddress , NotSupported ,
  LimitsExceeded , AccessDenied , NoServer , Timeout ,
  NoNetwork , AddressInUse , Disconnected , InvalidArgs ,
  UnknownMethod , TimedOut , InvalidSignature , UnknownInterface ,
  UnknownObject , UnknownProperty , PropertyReadOnly , InternalError ,
  InvalidService , InvalidObjectPath , InvalidInterface , InvalidMember ,
  LastErrorType = InvalidMember
}
 In order to facilitate verification of the most common D-Bus errors generated by the D-Bus implementation and by the bus daemon itself, QDBusError can be compared to a set of pre-defined values: More...
 

Public Member Functions

 QDBusError ()
 
 QDBusError (const DBusError *error)
 
Q_IMPLICIT QDBusError (const QDBusMessage &msg)
 
 QDBusError (ErrorType error, const QString &message)
 
 QDBusError (const QDBusError &other)
 
 QDBusError (QDBusError &&other) noexcept
 
QDBusErroroperator= (QDBusError &&other) noexcept
 
QDBusErroroperator= (const QDBusError &other)
 
QDBusErroroperator= (const QDBusMessage &msg)
 
void swap (QDBusError &other) noexcept
 Swaps this QDBusError instance with other.
 
ErrorType type () const
 Returns this error's ErrorType.
 
QString name () const
 Returns this error's name.
 
QString message () const
 Returns the message that the callee associated with this error.
 
bool isValid () const
 Returns true if this is a valid error condition (i.e., if there was an error), otherwise false.
 

Static Public Member Functions

static QString errorString (ErrorType error)
 

Detailed Description

\inmodule QtDBus

Since
4.2

The QDBusError class represents an error received from the D-Bus bus or from remote applications found in the bus.

When dealing with the D-Bus bus service or with remote applications over D-Bus, a number of error conditions can happen. This error conditions are sometimes signalled by a returned error value or by a QDBusError.

C++ and Java exceptions are a valid analogy for D-Bus errors: instead of returning normally with a return value, remote applications and the bus may decide to throw an error condition. However, the Qt D-Bus implementation does not use the C++ exception-throwing mechanism, so you will receive QDBusErrors in the return reply (see QDBusReply::error()).

QDBusError objects are used to inspect the error name and message as received from the bus and remote applications. You should not create such objects yourself to signal error conditions when called from D-Bus: instead, use QDBusMessage::createError() and QDBusConnection::send().

See also
QDBusConnection::send(), QDBusMessage, QDBusReply

Definition at line 20 of file qdbuserror.h.

Member Enumeration Documentation

◆ ErrorType

In order to facilitate verification of the most common D-Bus errors generated by the D-Bus implementation and by the bus daemon itself, QDBusError can be compared to a set of pre-defined values:

\value NoError QDBusError is invalid (i.e., the call succeeded) \value Other QDBusError contains an error that is not one of the well-known ones \value Failed The call failed (org.freedesktop.DBus.Error.Failed) \value NoMemory Out of memory (org.freedesktop.DBus.Error.NoMemory) \value ServiceUnknown The called service is not known (org.freedesktop.DBus.Error.ServiceUnknown) \value NoReply The called method did not reply within the specified timeout (org.freedesktop.DBus.Error.NoReply) \value BadAddress The address given is not valid (org.freedesktop.DBus.Error.BadAddress) \value NotSupported The call/operation is not supported (org.freedesktop.DBus.Error.NotSupported) \value LimitsExceeded The limits allocated to this process/call/connection exceeded the pre-defined values (org.freedesktop.DBus.Error.LimitsExceeded) \value AccessDenied The call/operation tried to access a resource it isn't allowed to (org.freedesktop.DBus.Error.AccessDenied) \value NoServer {Documentation doesn't say what this is for} (org.freedesktop.DBus.Error.NoServer) \value Timeout {Documentation doesn't say what this is for or how it's used} (org.freedesktop.DBus.Error.Timeout) \value NoNetwork {Documentation doesn't say what this is for} (org.freedesktop.DBus.Error.NoNetwork) \value AddressInUse QDBusServer tried to bind to an address that is already in use (org.freedesktop.DBus.Error.AddressInUse) \value Disconnected The call/process/message was sent after QDBusConnection disconnected (org.freedesktop.DBus.Error.Disconnected) \value InvalidArgs The arguments passed to this call/operation are not valid (org.freedesktop.DBus.Error.InvalidArgs) \value UnknownMethod The method called was not found in this object/interface with the given parameters (org.freedesktop.DBus.Error.UnknownMethod) \value TimedOut {Documentation doesn't say...} (org.freedesktop.DBus.Error.TimedOut) \value InvalidSignature The type signature is not valid or compatible (org.freedesktop.DBus.Error.InvalidSignature) \value UnknownInterface The interface is not known in this object (org.freedesktop.DBus.Error.UnknownInterface) \value UnknownObject The object path points to an object that does not exist (org.freedesktop.DBus.Error.UnknownObject) \value UnknownProperty The property does not exist in this interface (org.freedesktop.DBus.Error.UnknownProperty) \value PropertyReadOnly The property set failed because the property is read-only (org.freedesktop.DBus.Error.PropertyReadOnly)

\value InternalError An internal error occurred

\value InvalidObjectPath The object path provided is invalid.

\value InvalidService The service requested is invalid.

\value InvalidMember The member is invalid.

\value InvalidInterface The interface is invalid.

Enumerator
NoError 
Other 
Failed 
NoMemory 
ServiceUnknown 
NoReply 
BadAddress 
NotSupported 
LimitsExceeded 
AccessDenied 
NoServer 
Timeout 
NoNetwork 
AddressInUse 
Disconnected 
InvalidArgs 
UnknownMethod 
TimedOut 
InvalidSignature 
UnknownInterface 
UnknownObject 
UnknownProperty 
PropertyReadOnly 
InternalError 
InvalidService 
InvalidObjectPath 
InvalidInterface 
InvalidMember 
LastErrorType 

Definition at line 24 of file qdbuserror.h.

Constructor & Destructor Documentation

◆ QDBusError() [1/6]

QDBusError::QDBusError ( )

Constructs a QDBusError that represents no error.

Definition at line 160 of file qdbuserror.cpp.

References Q_UNUSED.

◆ QDBusError() [2/6]

QDBusError::QDBusError ( const DBusError * error)
explicit

Constructs a QDBusError from a DBusError structure.

Definition at line 173 of file qdbuserror.cpp.

References error, QString::fromUtf8(), and get().

+ Here is the call graph for this function:

◆ QDBusError() [3/6]

QDBusError::QDBusError ( const QDBusMessage & qdmsg)

Constructs a QDBusError from a QDBusMessage.

Definition at line 188 of file qdbuserror.cpp.

References QDBusMessage::ErrorMessage, and get().

+ Here is the call graph for this function:

◆ QDBusError() [4/6]

QDBusError::QDBusError ( ErrorType error,
const QString & mess )

Constructs a QDBusError from a well-known error code

Definition at line 204 of file qdbuserror.cpp.

References error, and errorMessages.

◆ QDBusError() [5/6]

QDBusError::QDBusError ( const QDBusError & other)

Constructs a QDBusError from another QDBusError object

Definition at line 215 of file qdbuserror.cpp.

◆ QDBusError() [6/6]

QDBusError::QDBusError ( QDBusError && other)
inlinenoexcept

Definition at line 68 of file qdbuserror.h.

Member Function Documentation

◆ errorString()

QString QDBusError::errorString ( ErrorType error)
static
Since
4.3 Returns the error name associated with error condition error.

Definition at line 301 of file qdbuserror.cpp.

References error, and errorMessages.

Referenced by QDBusMessage::createError(), and QDBusMessage::createErrorReply().

+ Here is the caller graph for this function:

◆ isValid()

bool QDBusError::isValid ( ) const

Returns true if this is a valid error condition (i.e., if there was an error), otherwise false.

Definition at line 292 of file qdbuserror.cpp.

References NoError.

Referenced by QDBusInterfacePrivate::QDBusInterfacePrivate(), and QDBusReply< T >::isValid().

+ Here is the caller graph for this function:

◆ message()

QString QDBusError::message ( ) const

Returns the message that the callee associated with this error.

Error messages are implementation defined and usually contain a human-readable error code, though this does not mean it is suitable for your end-users.

Definition at line 282 of file qdbuserror.cpp.

Referenced by QDBusMessage::createError(), QDBusMessage::createErrorReply(), and operator<<().

+ Here is the caller graph for this function:

◆ name()

QString QDBusError::name ( ) const

Returns this error's name.

Error names are similar to D-Bus Interface names, like org.freedesktop.DBus.InvalidArgs.

See also
type()

Definition at line 271 of file qdbuserror.cpp.

Referenced by QDBusMessage::createError(), QDBusMessage::createErrorReply(), and operator<<().

+ Here is the caller graph for this function:

◆ operator=() [1/3]

QDBusError & QDBusError::operator= ( const QDBusError & other)

Assignment operator

Definition at line 225 of file qdbuserror.cpp.

References other().

+ Here is the call graph for this function:

◆ operator=() [2/3]

QDBusError & QDBusError::operator= ( const QDBusMessage & qdmsg)

Assignment operator from a QDBusMessage

Definition at line 238 of file qdbuserror.cpp.

References QString::clear(), QDBusMessage::ErrorMessage, get(), and NoError.

+ Here is the call graph for this function:

◆ operator=() [3/3]

QDBusError & QDBusError::operator= ( QDBusError && other)
inlinenoexcept

Definition at line 71 of file qdbuserror.h.

References other(), and swap().

+ Here is the call graph for this function:

◆ swap()

void QDBusError::swap ( QDBusError & other)
inlinenoexcept

Swaps this QDBusError instance with other.

Definition at line 77 of file qdbuserror.h.

References other().

+ Here is the call graph for this function:

◆ type()

QDBusError::ErrorType QDBusError::type ( ) const

Returns this error's ErrorType.

See also
ErrorType

Definition at line 259 of file qdbuserror.cpp.


The documentation for this class was generated from the following files: