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> |
|---|---|
| CMake | target_link_libraries(app PRIVATE Nt::DBus) |
| Module | Nt D-Bus C++ Classes |
List of all members, including inherited members
Public Types
| enum | ErrorType |
Public Functions
| QDBusError() | |
| QDBusError(const QDBusMessage &message) | |
| QDBusError(ErrorType error, const QString &message) | |
| ErrorType | type() const |
| QString | name() const |
| QString | message() const |
| bool | isValid() const |
| void | swap(QDBusError &other) |
Static Public Members
| QString | errorString(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.
| Constant | Description |
|---|---|
QDBusError::NoError | No error. |
QDBusError::Other | An error whose name Nt does not know; see name(). |
QDBusError::Failed | A generic failure. |
QDBusError::NoMemory | Out of memory. |
QDBusError::ServiceUnknown | No service of that name exists and none can be started. |
QDBusError::NoReply | No reply arrived in time. |
QDBusError::BadAddress | The bus address is malformed. |
QDBusError::NotSupported | The operation is not supported. |
QDBusError::LimitsExceeded | A limit was exceeded. |
QDBusError::AccessDenied | Access was denied. |
QDBusError::NoServer | The bus or the peer could not be reached. |
QDBusError::Timeout | A timeout of the bus. |
QDBusError::NoNetwork | The network is not available. |
QDBusError::AddressInUse | The address is already in use. |
QDBusError::Disconnected | The connection is closed. |
QDBusError::InvalidArgs | The arguments are not valid. |
QDBusError::UnknownMethod | The method does not exist. |
QDBusError::TimedOut | The call timed out. |
QDBusError::InvalidSignature | The signature does not match. |
QDBusError::UnknownInterface | The interface does not exist. |
QDBusError::UnknownObject | No object exists at that path. |
QDBusError::UnknownProperty | The property does not exist. |
QDBusError::PropertyReadOnly | The property cannot be written. |
QDBusError::InternalError | An error inside Nt. |
QDBusError::InvalidService | The service name is not valid. |
QDBusError::InvalidObjectPath | The object path is not valid. |
QDBusError::InvalidInterface | The interface name is not valid. |
QDBusError::InvalidMember | The method or signal name is not valid. |
Member Function Documentation
QDBusError::QDBusError()
Constructs an error of the type NoError.
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.
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.