QDBusError Class Reference

Class for transporting D-Bus errors. More...

#include <qdbuserror.h>

List of all members.

Public Types

enum  ErrorType {
  InvalidError, Failed, NoMemory, ServiceUnknown,
  NameHasNoOwner, NoReply, IOError, BadAddress,
  NotSupported, LimitsExceeded, AccessDenied, AuthFailed,
  NoServer, Timeout, NoNetwork, Disconnected,
  InvalidArgs, FileNotFound, FileExists, UnknownMethod,
  TimedOut, InvalidSignature, UserDefined
}
 

Enum of standard D-Bus error types.

More...

Public Member Functions

 QDBusError ()
 Creates an empty and invalid error object.
 QDBusError (const DBusError *error)
 Creates an error object from an C API D-Bus error object.
 QDBusError (const QString &error, const QString &message)
 Creates an error object for its two given components.
QString name () const
 Returns the D-Bus error name.
QString message () const
 Returns a string describing the error.
ErrorType type () const
 Returns a type for checking of standard errors.
bool isValid () const
 Returns whether the error object is valid.

Static Public Member Functions

static QDBusError stdFailed (const QString &message)
 Creates a D-Bus standard error for generic failure.
static QDBusError stdNoMemory (const QString &message)
 Creates a D-Bus standard error for out of memory situations.
static QDBusError stdNoReply (const QString &message)
 Creates a D-Bus standard error for expected reply missing.
static QDBusError stdIOError (const QString &message)
 Creates a D-Bus standard error for generic IO errors.
static QDBusError stdNotSupported (const QString &message)
 Creates a D-Bus standard error for unsupported operations.
static QDBusError stdLimitsExceeded (const QString &message)
 Creates a D-Bus standard error for exceeding a limited resource.
static QDBusError stdAccessDenied (const QString &message)
 Creates a D-Bus standard error for access to a resource being denied.
static QDBusError stdAuthFailed (const QString &message)
 Creates a D-Bus standard error for failed authentification.
static QDBusError stdTimeout (const QString &message)
 Creates a D-Bus standard error for timeouts during operations.
static QDBusError stdInvalidArgs (const QString &message)
 Creates a D-Bus standard error for call arguments being invalid.
static QDBusError stdFileNotFound (const QString &message)
 Creates a D-Bus standard error for a file not being available.
static QDBusError stdFileExists (const QString &message)
 Creates a D-Bus standard error for a file being in the way.
static QDBusError stdUnknownMethod (const QString &message)
 Creates a D-Bus standard error for an unknown methods being called.
static QDBusError stdInvalidSignature (const QString &message)
 Creates a D-Bus standard error for D-Bus type signature not valid.

Detailed Description

Class for transporting D-Bus errors.

A D-Bus error has two parts: an error name (see section Error names) and a message string detailing the error in human presentable form.

Examples:

example-client.cpp, and example-service.cpp.


Member Enumeration Documentation

Enum of standard D-Bus error types.

D-Bus defines a list of common error types and their names. The values of this enum map to those an application is likely to encounter and likely to create itself.

Standard errors can either be created by specifying the D-Bus error name or, as a convenience, by using factory methods of this class for the most common ones.

All D-Bus standard error names are within the "org.freedesktop.DBus.Error" namespace.

See also:
name()
Enumerator:
InvalidError 

QDBusError specific value, to represent invalid error objects.

See also:
isValid()
Failed 

Generic failure cause.

Can be used whenever the other predefined errors do no match. Basically just meaning "something when wrong, see message() for details"

See also:
stdFailed()
NoMemory 

An operation could not allocate enough memory.

See also:
stdNoMemory()
ServiceUnknown 

An addressed service is neither connected nor can it be activated.

NameHasNoOwner 

A non-unique name used in a message is not known.

If a message addresses a D-Bus connection through a non-unique (requested) name and the D-Bus does not have a mapping to any of the unique names.

NoReply 

An call failed to send a reply but one was expected.

See also:
stdNoReply()
IOError 

An IO error occured during an operation.

Generic indicator that some kind of IO operation failed, e.g. reading from a socket.

See also:
stdIOError()
BadAddress 

Caused by trying to connect to a malformed address.

Returned by QDBusConnection's addConnection if the specified address isn't a valid D-Bus bus address.

See also:
QDBusConnection::addConnection(const QString&,const QString&);
NotSupported 

An otherwise valid operation request could not be handled.

Primarily useful when a service implements a specific interface but does not (yet) handle all possible situations.

See also:
stdNotSupported()
LimitsExceeded 

Use of a limited resource reached its limit.

See also:
stdLimitsExceeded()
AccessDenied 

Caused by security restrictions denying an operation.

Primarily useful when a client tries to manipulate resources a service has associated with a different client and which should not be changable by anyone else.

See also:
stdAccessDenied()
AuthFailed 

An authentification mechanism failed.

See also:
stdAuthFailed()
NoServer 

Connection to a D-Bus server failed.

Timeout 

An timeout occured during an operation.

Warning:
D-Bus defined to quite similar errors but does not detail when either one can occur. See TimedOut
See also:
stdTimeout()
NoNetwork 

The network intended as a transport channel is not available.

Disconnected 

Caused by trying to use an unconnected D-Bus connection.

See also:
QDBusConnection::isConnected()
InvalidArgs 

Caused by invalid arguments passed to a method call.

Primarily usefull for service implementations when the incoming call does not transport the expected parameters, e.g. wrong types or wrong values.

See also:
stdInvalidArgs()
FileNotFound 

A file necessary for an operation is not avaiable.

See also:
stdFileNotFound()
FileExists 

Target file exists but operation does not allow overwriting.

See also:
stdFileExists()
UnknownMethod 

A method call addresses and unknown method.

See also:
stdUnknownMethod()
TimedOut 

An operation timed out.

Warning:
D-Bus defined to quite similar errors but does not detail when either one can occur. See Timeout
InvalidSignature 

An type signature is not valid.

A possible cause is a QDBusVariant with an invalid signature, i.e. the transported signature is empty, contains unknown type characters or has mismatched container enclosings.

Note:
in case a service implementation wants to indicate that a method call did not transport the correct parameter types, use InvalidArgs instead
See also:
stdInvalidSignature()
UserDefined 

Generic type for all errors not matching on of the other predefined.

See also:
QDBusError(const QString&,const QString&);

Constructor & Destructor Documentation

QDBusError::QDBusError (  ) 

Creates an empty and invalid error object.

QDBusError::QDBusError ( const DBusError *  error  ) 

Creates an error object from an C API D-Bus error object.

Parameters:
error a pointer to the C API D-Bus error
QDBusError::QDBusError ( const QString &  error,
const QString &  message 
)

Creates an error object for its two given components.

Parameters:
error a D-Bus error name
message the potentially i18n'ed error description message
See also:
name()

Member Function Documentation

bool QDBusError::isValid (  )  const

Returns whether the error object is valid.

A QDBusError is considered valid if both name and message are set.

Returns:
true if neither name nor message is QString::null and the error type is a valid type
Examples:
example-client.cpp.
QString QDBusError::message (  )  const [inline]

Returns a string describing the error.

The message is meant to further detail or describe the error. It is usually a translated error message meant for direct presentation to the user.

Returns:
the error's message
See also:
name()
Examples:
example-client.cpp.
QString QDBusError::name (  )  const [inline]

Returns the D-Bus error name.

See section Error names for details.

Returns:
the D-Bus error name
See also:
message()
Examples:
example-client.cpp.
static QDBusError QDBusError::stdAccessDenied ( const QString &  message  )  [static]

Creates a D-Bus standard error for access to a resource being denied.

Parameters:
message the message detailing the encountered problem
Returns:
an error object of type AccessDenied with the given message
static QDBusError QDBusError::stdAuthFailed ( const QString &  message  )  [static]

Creates a D-Bus standard error for failed authentification.

Parameters:
message the message detailing the encountered problem
Returns:
an error object of type AuthFailed with the given message
static QDBusError QDBusError::stdFailed ( const QString &  message  )  [static]

Creates a D-Bus standard error for generic failure.

Parameters:
message the message detailing the encountered problem
Returns:
an error object of type Failed with the given message
static QDBusError QDBusError::stdFileExists ( const QString &  message  )  [static]

Creates a D-Bus standard error for a file being in the way.

Parameters:
message the message detailing the encountered problem
Returns:
an error object of type FileExists with the given message
static QDBusError QDBusError::stdFileNotFound ( const QString &  message  )  [static]

Creates a D-Bus standard error for a file not being available.

Parameters:
message the message detailing the encountered problem
Returns:
an error object of type FileNotFound with the given message
static QDBusError QDBusError::stdInvalidArgs ( const QString &  message  )  [static]

Creates a D-Bus standard error for call arguments being invalid.

Parameters:
message the message detailing the encountered problem
Returns:
an error object of type InvalidArgs with the given message
Examples:
example-service.cpp.
static QDBusError QDBusError::stdInvalidSignature ( const QString &  message  )  [static]

Creates a D-Bus standard error for D-Bus type signature not valid.

Parameters:
message the message detailing the encountered problem
Returns:
an error object of type InvalidSignature with the given message
static QDBusError QDBusError::stdIOError ( const QString &  message  )  [static]

Creates a D-Bus standard error for generic IO errors.

Parameters:
message the message detailing the encountered problem
Returns:
an error object of type IOError with the given message
static QDBusError QDBusError::stdLimitsExceeded ( const QString &  message  )  [static]

Creates a D-Bus standard error for exceeding a limited resource.

Parameters:
message the message detailing the encountered problem
Returns:
an error object of type LimitsExceeded with the given message
static QDBusError QDBusError::stdNoMemory ( const QString &  message  )  [static]

Creates a D-Bus standard error for out of memory situations.

Parameters:
message the message detailing the encountered problem
Returns:
an error object of type NoMemory with the given message
static QDBusError QDBusError::stdNoReply ( const QString &  message  )  [static]

Creates a D-Bus standard error for expected reply missing.

Parameters:
message the message detailing the encountered problem
Returns:
an error object of type NoReply with the given message
static QDBusError QDBusError::stdNotSupported ( const QString &  message  )  [static]

Creates a D-Bus standard error for unsupported operations.

Parameters:
message the message detailing the encountered problem
Returns:
an error object of type NotSupported with the given message
static QDBusError QDBusError::stdTimeout ( const QString &  message  )  [static]

Creates a D-Bus standard error for timeouts during operations.

Parameters:
message the message detailing the encountered problem
Returns:
an error object of type Timeout with the given message
static QDBusError QDBusError::stdUnknownMethod ( const QString &  message  )  [static]

Creates a D-Bus standard error for an unknown methods being called.

Parameters:
message the message detailing the encountered problem
Returns:
an error object of type UnknownMethod with the given message
ErrorType QDBusError::type (  )  const [inline]

Returns a type for checking of standard errors.

D-Bus specifies a couple of standard error names, which are mapped to QDBusError types in order to make creating and checking for them easier.

Returns:
the error's type
See also:
name()

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

Generated by  doxygen 1.6.2