QDBusError 类

QDBusError 类表示从 D-Bus 总线或从在总线中发现的远程应用程序收到的错误。 更多...

头: #include <QDBusError>
qmake: QT += dbus
Since: Qt 4.2

该类在 Qt 4.2 引入。

公共类型

enum ErrorType { NoError, Other, Failed, NoMemory, ServiceUnknown, …, InvalidInterface }

公共函数

bool isValid () const
QString message () const
QString name () const
void swap (QDBusError & other )
QDBusError::ErrorType type () const

静态公共成员

QString errorString (QDBusError::ErrorType error )

详细描述

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 () 和 QDBusConnection::send ().

另请参阅 QDBusConnection::send (), QDBusMessage ,和 QDBusReply .

成员类型文档编制

enum QDBusError:: 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:

常量 描述
QDBusError::NoError 0 QDBusError is invalid (i.e., the call succeeded)
QDBusError::Other 1 QDBusError contains an error that is not one of the well-known ones
QDBusError::Failed 2 The call failed ( org.freedesktop.DBus.Error.Failed )
QDBusError::NoMemory 3 Out of memory ( org.freedesktop.DBus.Error.NoMemory )
QDBusError::ServiceUnknown 4 The called service is not known ( org.freedesktop.DBus.Error.ServiceUnknown )
QDBusError::NoReply 5 The called method did not reply within the specified timeout ( org.freedesktop.DBus.Error.NoReply )
QDBusError::BadAddress 6 The address given is not valid ( org.freedesktop.DBus.Error.BadAddress )
QDBusError::NotSupported 7 The call/operation is not supported ( org.freedesktop.DBus.Error.NotSupported )
QDBusError::LimitsExceeded 8 The limits allocated to this process/call/connection exceeded the pre-defined values ( org.freedesktop.DBus.Error.LimitsExceeded )
QDBusError::AccessDenied 9 The call/operation tried to access a resource it isn't allowed to ( org.freedesktop.DBus.Error.AccessDenied )
QDBusError::NoServer 10 Documentation doesn't say what this is for ( org.freedesktop.DBus.Error.NoServer )
QDBusError::Timeout 11 Documentation doesn't say what this is for or how it's used ( org.freedesktop.DBus.Error.Timeout )
QDBusError::NoNetwork 12 Documentation doesn't say what this is for ( org.freedesktop.DBus.Error.NoNetwork )
QDBusError::AddressInUse 13 QDBusServer tried to bind to an address that is already in use ( org.freedesktop.DBus.Error.AddressInUse )
QDBusError::Disconnected 14 The call/process/message was sent after QDBusConnection disconnected ( org.freedesktop.DBus.Error.Disconnected )
QDBusError::InvalidArgs 15 The arguments passed to this call/operation are not valid ( org.freedesktop.DBus.Error.InvalidArgs )
QDBusError::UnknownMethod 16 The method called was not found in this object/interface with the given parameters ( org.freedesktop.DBus.Error.UnknownMethod )
QDBusError::TimedOut 17 Documentation doesn't say... ( org.freedesktop.DBus.Error.TimedOut )
QDBusError::InvalidSignature 18 The type signature is not valid or compatible ( org.freedesktop.DBus.Error.InvalidSignature )
QDBusError::UnknownInterface 19 The interface is not known in this object ( org.freedesktop.DBus.Error.UnknownInterface )
QDBusError::UnknownObject 20 The object path points to an object that does not exist ( org.freedesktop.DBus.Error.UnknownObject )
QDBusError::UnknownProperty 21 The property does not exist in this interface ( org.freedesktop.DBus.Error.UnknownProperty )
QDBusError::PropertyReadOnly 22 The property set failed because the property is read-only ( org.freedesktop.DBus.Error.PropertyReadOnly )
QDBusError::InternalError 23 An internal error occurred
QDBusError::InvalidObjectPath 25 The object path provided is invalid.
QDBusError::InvalidService 24 The service requested is invalid.
QDBusError::InvalidMember 27 The member is invalid.
QDBusError::InvalidInterface 26 The interface is invalid.

成员函数文档编制

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

Returns the error name associated with error condition error .

该函数在 Qt 4.3 引入。

bool QDBusError:: isValid () const

返回 true if this is a valid error condition (i.e., if there was an error), 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 .

另请参阅 type ().

void QDBusError:: swap ( QDBusError & other )

交换此 QDBusError 实例与 other .

QDBusError::ErrorType QDBusError:: type () const

Returns this error's ErrorType .

另请参阅 ErrorType .