CopperSpice DBUS  1.7.4
QDBusError Class Reference

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

Public Types

enum  ErrorType
 

Public Methods

 QDBusError (QDBusError &&other) noexcept
 
bool isValid () const
 
QString message () const
 
QString name () const
 
QDBusError & operator= (QDBusError &&other) noexcept
 
void swap (QDBusError &other) noexcept
 
ErrorType type () const
 

Static Public Methods

static QString errorString (ErrorType error)
 

Detailed Description

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 &CsDbus implementation does not use the C++ exception-throwing mechanism, so you will receive QDBusErrors in the return reply.

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(), QDBusReply::error(), QDBusMessage, QDBusReply

Member Enumeration Documentation

ConstantValueDescription
QDBusMessage::MethodCallMessage 1 Message representing an outgoing or incoming method call
QDBusMessage::SignalMessage 4 Message representing an outgoing or incoming signal emission
QDBusMessage::ReplyMessage 2 Message representing the return values of a method call
QDBusMessage::ErrorMessage 3 Error condition in response to a method call
QDBusMessage::InvalidMessage 0 An invalid message: this is never set on messages received from D-Bus

Constructor & Destructor Documentation

QDBusError::QDBusError ( QDBusError &&  other)
inlinenoexcept

Move constructs a new QBusError from other.

Method Documentation

QString QDBusError::errorString ( ErrorType  error)
static

Returns the error name associated with error condition error.

bool QDBusError::isValid ( ) const

Returns true if this is a valid error condition, otherwise false.

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.

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()
QDBusError & QDBusError::operator= ( QDBusError &&  other)
inlinenoexcept

Move assigns from other and returns a reference to this object.

void QDBusError::swap ( QDBusError &  other)
inlinenoexcept

Swaps other with this object. This operation is very fast and never fails.

ErrorType QDBusError::type ( ) const

Returns this error's ErrorType.

See also
ErrorType