6.0.0-rc4Source

QDBusError Class

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

Header#include <QDBusError>
CMaketarget_link_libraries(app PRIVATE Nt::DBus)
ModuleNt D-Bus C++ Classes

List of all members, including inherited members

Public Types

enumErrorType

Public Functions

QDBusError()
QDBusError(const QDBusMessage &message)
QDBusError(ErrorType error, const QString &message)
ErrorTypetype() const
QStringname() const
QStringmessage() const
boolisValid() const
voidswap(QDBusError &other)

Static Public Members

QStringerrorString(ErrorType error)

Detailed Description

An error has a type, a D-Bus error name such as org.freedesktop.DBus.Error.UnknownMethod, and a text for people:

QDBusReply<QString> reply = iface.call("Name");
if (!reply.isValid())
    qWarning() << reply.error().name() << reply.error().message();

See also QDBusMessage and QDBusReply.

Differences from Qt

There is no QDebug stream operator. The errors that Nt itself generates use the same names as Qt's, so that peers which match on them work unchanged.

Member Type Documentation

enum QDBusError::ErrorType

The errors that Nt knows by name.

ConstantDescription
QDBusError::NoErrorNo error.
QDBusError::OtherAn error whose name Nt does not know; see name().
QDBusError::FailedA generic failure.
QDBusError::NoMemoryOut of memory.
QDBusError::ServiceUnknownNo service of that name exists and none can be started.
QDBusError::NoReplyNo reply arrived in time.
QDBusError::BadAddressThe bus address is malformed.
QDBusError::NotSupportedThe operation is not supported.
QDBusError::LimitsExceededA limit was exceeded.
QDBusError::AccessDeniedAccess was denied.
QDBusError::NoServerThe bus or the peer could not be reached.
QDBusError::TimeoutA timeout of the bus.
QDBusError::NoNetworkThe network is not available.
QDBusError::AddressInUseThe address is already in use.
QDBusError::DisconnectedThe connection is closed.
QDBusError::InvalidArgsThe arguments are not valid.
QDBusError::UnknownMethodThe method does not exist.
QDBusError::TimedOutThe call timed out.
QDBusError::InvalidSignatureThe signature does not match.
QDBusError::UnknownInterfaceThe interface does not exist.
QDBusError::UnknownObjectNo object exists at that path.
QDBusError::UnknownPropertyThe property does not exist.
QDBusError::PropertyReadOnlyThe property cannot be written.
QDBusError::InternalErrorAn error inside Nt.
QDBusError::InvalidServiceThe service name is not valid.
QDBusError::InvalidObjectPathThe object path is not valid.
QDBusError::InvalidInterfaceThe interface name is not valid.
QDBusError::InvalidMemberThe method or signal name is not valid.

Member Function Documentation

QDBusError::QDBusError()

Constructs an error of the type NoError.

[explicit] QDBusError::QDBusError(const QDBusMessage &message)

Constructs the error that the error message message carries. Any other kind of message gives NoError.

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

Constructs an error of the type error with the text message.

[static] QString QDBusError::errorString(ErrorType error)

Returns the D-Bus name of the errors of the type error.

bool QDBusError::isValid() const

Returns true if this is an error, that is, not of the type NoError.

QString QDBusError::message() const

Returns the text of the error.

QString QDBusError::name() const

Returns the D-Bus name of the error.

void QDBusError::swap(QDBusError &other)

Swaps this error with other.

ErrorType QDBusError::type() const

Returns the type of the error.