DBus-1-TQt  1.0
TQT_DBusError Class Reference

#include <tqdbuserror.h>

+ Collaboration diagram for TQT_DBusError:

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
}
 

Public Member Functions

 TQT_DBusError ()
 
 TQT_DBusError (const DBusError *error)
 
 TQT_DBusError (const TQString &error, const TQString &message)
 
TQString name () const
 
TQString message () const
 
ErrorType type () const
 
bool dbusErrorSet () const
 
void setDBUSError (bool err) const
 
bool isValid () const
 

Static Public Member Functions

static TQT_DBusError stdFailed (const TQString &message)
 
static TQT_DBusError stdNoMemory (const TQString &message)
 
static TQT_DBusError stdNoReply (const TQString &message)
 
static TQT_DBusError stdIOError (const TQString &message)
 
static TQT_DBusError stdNotSupported (const TQString &message)
 
static TQT_DBusError stdLimitsExceeded (const TQString &message)
 
static TQT_DBusError stdAccessDenied (const TQString &message)
 
static TQT_DBusError stdAuthFailed (const TQString &message)
 
static TQT_DBusError stdTimeout (const TQString &message)
 
static TQT_DBusError stdInvalidArgs (const TQString &message)
 
static TQT_DBusError stdFileNotFound (const TQString &message)
 
static TQT_DBusError stdFileExists (const TQString &message)
 
static TQT_DBusError stdUnknownMethod (const TQString &message)
 
static TQT_DBusError stdInvalidSignature (const TQString &message)
 

Private Member Functions

 TQT_DBusError (ErrorType type, const TQString &message)
 

Private Attributes

ErrorType errorType
 
bool m_dbusErrorSet
 
TQString nm
 
TQString msg
 

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.

Definition at line 40 of file tqdbuserror.h.

Member Enumeration Documentation

◆ ErrorType

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 

TQT_DBusError 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 TQT_DBusConnection's addConnection if the specified address isn't a valid D-Bus bus address.

See also
TQT_DBusConnection::addConnection(const TQString&,const TQString&);
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
TQT_DBusConnection::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 TQT_DBusVariant 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
TQT_DBusError(const TQString&,const TQString&);

Definition at line 59 of file tqdbuserror.h.

60  {
67 
76  Failed,
77 
83  NoMemory,
84 
89 
98 
104  NoReply,
105 
114  IOError,
115 
124  BadAddress,
125 
134  NotSupported,
135 
142 
152  AccessDenied,
153 
159  AuthFailed,
160 
164  NoServer,
165 
174  Timeout,
175 
179  NoNetwork,
180 
186  Disconnected,
187 
197  InvalidArgs,
198 
204  FileNotFound,
205 
211  FileExists,
212 
219 
226  TimedOut,
227 
242 
249  };

Constructor & Destructor Documentation

◆ TQT_DBusError() [1/4]

TQT_DBusError::TQT_DBusError ( )

Creates an empty and invalid error object.

Definition at line 116 of file tqdbuserror.cpp.

117 {
118 }
+ Here is the caller graph for this function:

◆ TQT_DBusError() [2/4]

TQT_DBusError::TQT_DBusError ( const DBusError *  error)

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

Parameters
errora pointer to the C API D-Bus error

Definition at line 120 of file tqdbuserror.cpp.

121 {
122  if (!error || !dbus_error_is_set(error))
123  return;
124 
125  nm = TQString::fromUtf8(error->name);
126  msg = TQString::fromUtf8(error->message);
127 
129 }

References errorType, msg, nm, and qDBusErrorTypeForName().

+ Here is the call graph for this function:

◆ TQT_DBusError() [3/4]

TQT_DBusError::TQT_DBusError ( const TQString &  error,
const TQString &  message 
)

Creates an error object for its two given components.

Parameters
errora D-Bus error name
messagethe potentially i18n'ed error description message
See also
name()

Definition at line 131 of file tqdbuserror.cpp.

132  : errorType(UserDefined), m_dbusErrorSet(false), nm(error), msg(message)
133 {
135 }

References errorType, nm, and qDBusErrorTypeForName().

+ Here is the call graph for this function:

◆ TQT_DBusError() [4/4]

TQT_DBusError::TQT_DBusError ( ErrorType  type,
const TQString &  message 
)
private

Creates an error object for one of the standard D-Bus errors.

Parameters
typeone of the standard error causes
messagethe potentially i18n'ed error description message
See also
ErrorType

Definition at line 142 of file tqdbuserror.cpp.

144 {
146 }

References nm, qDBusErrorNameForType(), and type().

+ Here is the call graph for this function:

Member Function Documentation

◆ dbusErrorSet()

bool TQT_DBusError::dbusErrorSet ( ) const
inline

Returns whether the error was caused by DBUS itself.

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

Returns
true if dbus_error_is_set was true after DBUS call completion

Definition at line 316 of file tqdbuserror.h.

316 { return m_dbusErrorSet; }

◆ isValid()

bool TQT_DBusError::isValid ( ) const

Returns whether the error object is valid.

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

Returns
true if neither name nor message is TQString() and the error type is a valid type

Definition at line 137 of file tqdbuserror.cpp.

138 {
139  return errorType != InvalidError && !nm.isEmpty() && !msg.isEmpty();
140 }

References errorType, InvalidError, msg, and nm.

+ Here is the caller graph for this function:

◆ message()

TQString TQT_DBusError::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()

Definition at line 295 of file tqdbuserror.h.

295 { return msg; }
+ Here is the caller graph for this function:

◆ name()

TQString TQT_DBusError::name ( ) const
inline

Returns the D-Bus error name.

See section Error names for details.

Returns
the D-Bus error name
See also
message()

Definition at line 282 of file tqdbuserror.h.

282 { return nm; }
+ Here is the caller graph for this function:

◆ setDBUSError()

void TQT_DBusError::setDBUSError ( bool  err) const
inline

Definition at line 321 of file tqdbuserror.h.

321 { m_dbusErrorSet = err; }
+ Here is the caller graph for this function:

◆ stdAccessDenied()

TQT_DBusError TQT_DBusError::stdAccessDenied ( const TQString &  message)
static

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

Parameters
messagethe message detailing the encountered problem
Returns
an error object of type AccessDenied with the given message

Definition at line 178 of file tqdbuserror.cpp.

179 {
181 }

References AccessDenied, message(), and TQT_DBusError().

+ Here is the call graph for this function:

◆ stdAuthFailed()

TQT_DBusError TQT_DBusError::stdAuthFailed ( const TQString &  message)
static

Creates a D-Bus standard error for failed authentification.

Parameters
messagethe message detailing the encountered problem
Returns
an error object of type AuthFailed with the given message

Definition at line 183 of file tqdbuserror.cpp.

184 {
186 }

References AuthFailed, message(), and TQT_DBusError().

+ Here is the call graph for this function:

◆ stdFailed()

TQT_DBusError TQT_DBusError::stdFailed ( const TQString &  message)
static

Creates a D-Bus standard error for generic failure.

Parameters
messagethe message detailing the encountered problem
Returns
an error object of type Failed with the given message

Definition at line 148 of file tqdbuserror.cpp.

149 {
151 }

References Failed, message(), and TQT_DBusError().

+ Here is the call graph for this function:

◆ stdFileExists()

TQT_DBusError TQT_DBusError::stdFileExists ( const TQString &  message)
static

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

Parameters
messagethe message detailing the encountered problem
Returns
an error object of type FileExists with the given message

Definition at line 203 of file tqdbuserror.cpp.

204 {
206 }

References FileExists, message(), and TQT_DBusError().

+ Here is the call graph for this function:

◆ stdFileNotFound()

TQT_DBusError TQT_DBusError::stdFileNotFound ( const TQString &  message)
static

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

Parameters
messagethe message detailing the encountered problem
Returns
an error object of type FileNotFound with the given message

Definition at line 198 of file tqdbuserror.cpp.

199 {
201 }

References FileNotFound, message(), and TQT_DBusError().

+ Here is the call graph for this function:

◆ stdInvalidArgs()

TQT_DBusError TQT_DBusError::stdInvalidArgs ( const TQString &  message)
static

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

Parameters
messagethe message detailing the encountered problem
Returns
an error object of type InvalidArgs with the given message

Definition at line 193 of file tqdbuserror.cpp.

194 {
196 }

References InvalidArgs, message(), and TQT_DBusError().

+ Here is the call graph for this function:

◆ stdInvalidSignature()

TQT_DBusError TQT_DBusError::stdInvalidSignature ( const TQString &  message)
static

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

Parameters
messagethe message detailing the encountered problem
Returns
an error object of type InvalidSignature with the given message

Definition at line 213 of file tqdbuserror.cpp.

214 {
216 }

References InvalidSignature, message(), and TQT_DBusError().

+ Here is the call graph for this function:

◆ stdIOError()

TQT_DBusError TQT_DBusError::stdIOError ( const TQString &  message)
static

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

Parameters
messagethe message detailing the encountered problem
Returns
an error object of type IOError with the given message

Definition at line 163 of file tqdbuserror.cpp.

164 {
166 }

References IOError, message(), and TQT_DBusError().

+ Here is the call graph for this function:

◆ stdLimitsExceeded()

TQT_DBusError TQT_DBusError::stdLimitsExceeded ( const TQString &  message)
static

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

Parameters
messagethe message detailing the encountered problem
Returns
an error object of type LimitsExceeded with the given message

Definition at line 173 of file tqdbuserror.cpp.

174 {
176 }

References LimitsExceeded, message(), and TQT_DBusError().

+ Here is the call graph for this function:

◆ stdNoMemory()

TQT_DBusError TQT_DBusError::stdNoMemory ( const TQString &  message)
static

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

Parameters
messagethe message detailing the encountered problem
Returns
an error object of type NoMemory with the given message

Definition at line 153 of file tqdbuserror.cpp.

154 {
156 }

References message(), NoMemory, and TQT_DBusError().

+ Here is the call graph for this function:

◆ stdNoReply()

TQT_DBusError TQT_DBusError::stdNoReply ( const TQString &  message)
static

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

Parameters
messagethe message detailing the encountered problem
Returns
an error object of type NoReply with the given message

Definition at line 158 of file tqdbuserror.cpp.

159 {
161 }

References message(), NoReply, and TQT_DBusError().

+ Here is the call graph for this function:

◆ stdNotSupported()

TQT_DBusError TQT_DBusError::stdNotSupported ( const TQString &  message)
static

Creates a D-Bus standard error for unsupported operations.

Parameters
messagethe message detailing the encountered problem
Returns
an error object of type NotSupported with the given message

Definition at line 168 of file tqdbuserror.cpp.

169 {
171 }

References message(), NotSupported, and TQT_DBusError().

+ Here is the call graph for this function:

◆ stdTimeout()

TQT_DBusError TQT_DBusError::stdTimeout ( const TQString &  message)
static

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

Parameters
messagethe message detailing the encountered problem
Returns
an error object of type Timeout with the given message

Definition at line 188 of file tqdbuserror.cpp.

189 {
191 }

References message(), Timeout, and TQT_DBusError().

+ Here is the call graph for this function:

◆ stdUnknownMethod()

TQT_DBusError TQT_DBusError::stdUnknownMethod ( const TQString &  message)
static

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

Parameters
messagethe message detailing the encountered problem
Returns
an error object of type UnknownMethod with the given message

Definition at line 208 of file tqdbuserror.cpp.

209 {
211 }

References message(), TQT_DBusError(), and UnknownMethod.

+ Here is the call graph for this function:

◆ type()

ErrorType TQT_DBusError::type ( ) const
inline

Returns a type for checking of standard errors.

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

Returns
the error's type
See also
name()

Definition at line 307 of file tqdbuserror.h.

307 { return errorType; }
+ Here is the caller graph for this function:

Member Data Documentation

◆ errorType

ErrorType TQT_DBusError::errorType
private

Definition at line 460 of file tqdbuserror.h.

◆ m_dbusErrorSet

bool TQT_DBusError::m_dbusErrorSet
mutableprivate

Definition at line 461 of file tqdbuserror.h.

◆ msg

TQString TQT_DBusError::msg
private

Definition at line 463 of file tqdbuserror.h.

◆ nm

TQString TQT_DBusError::nm
private

Definition at line 463 of file tqdbuserror.h.


The documentation for this class was generated from the following files:
TQT_DBusError::UnknownMethod
@ UnknownMethod
A method call addresses and unknown method.
Definition: tqdbuserror.h:218
TQT_DBusError::m_dbusErrorSet
bool m_dbusErrorSet
Definition: tqdbuserror.h:461
TQT_DBusError::AuthFailed
@ AuthFailed
An authentification mechanism failed.
Definition: tqdbuserror.h:159
TQT_DBusError::message
TQString message() const
Returns a string describing the error.
Definition: tqdbuserror.h:295
qDBusErrorTypeForName
static TQT_DBusError::ErrorType qDBusErrorTypeForName(const TQString &name)
Definition: tqdbuserror.cpp:103
TQT_DBusError::FileExists
@ FileExists
Target file exists but operation does not allow overwriting.
Definition: tqdbuserror.h:211
TQT_DBusError::LimitsExceeded
@ LimitsExceeded
Use of a limited resource reached its limit.
Definition: tqdbuserror.h:141
TQT_DBusError::TQT_DBusError
TQT_DBusError()
Creates an empty and invalid error object.
Definition: tqdbuserror.cpp:116
TQT_DBusError::InvalidSignature
@ InvalidSignature
An type signature is not valid.
Definition: tqdbuserror.h:241
TQT_DBusError::NoNetwork
@ NoNetwork
The network intended as a transport channel is not available.
Definition: tqdbuserror.h:179
TQT_DBusError::msg
TQString msg
Definition: tqdbuserror.h:463
TQT_DBusError::nm
TQString nm
Definition: tqdbuserror.h:463
TQT_DBusError::ServiceUnknown
@ ServiceUnknown
An addressed service is neither connected nor can it be activated.
Definition: tqdbuserror.h:88
TQT_DBusError::NameHasNoOwner
@ NameHasNoOwner
A non-unique name used in a message is not known.
Definition: tqdbuserror.h:97
TQT_DBusError::NotSupported
@ NotSupported
An otherwise valid operation request could not be handled.
Definition: tqdbuserror.h:134
TQT_DBusError::Timeout
@ Timeout
An timeout occured during an operation.
Definition: tqdbuserror.h:174
TQT_DBusError::NoReply
@ NoReply
An call failed to send a reply but one was expected.
Definition: tqdbuserror.h:104
TQT_DBusError::BadAddress
@ BadAddress
Caused by trying to connect to a malformed address.
Definition: tqdbuserror.h:124
TQT_DBusError::AccessDenied
@ AccessDenied
Caused by security restrictions denying an operation.
Definition: tqdbuserror.h:152
TQT_DBusError::UserDefined
@ UserDefined
Generic type for all errors not matching on of the other predefined.
Definition: tqdbuserror.h:248
TQT_DBusError::IOError
@ IOError
An IO error occured during an operation.
Definition: tqdbuserror.h:114
TQT_DBusError::FileNotFound
@ FileNotFound
A file necessary for an operation is not avaiable.
Definition: tqdbuserror.h:204
qDBusErrorNameForType
static TQString qDBusErrorNameForType(TQT_DBusError::ErrorType type)
Definition: tqdbuserror.cpp:34
TQT_DBusError::NoMemory
@ NoMemory
An operation could not allocate enough memory.
Definition: tqdbuserror.h:83
TQT_DBusError::Disconnected
@ Disconnected
Caused by trying to use an unconnected D-Bus connection.
Definition: tqdbuserror.h:186
TQT_DBusError::errorType
ErrorType errorType
Definition: tqdbuserror.h:460
TQT_DBusError::Failed
@ Failed
Generic failure cause.
Definition: tqdbuserror.h:76
TQT_DBusError::InvalidError
@ InvalidError
TQT_DBusError specific value, to represent invalid error objects.
Definition: tqdbuserror.h:66
TQT_DBusError::NoServer
@ NoServer
Connection to a D-Bus server failed.
Definition: tqdbuserror.h:164
TQT_DBusError::type
ErrorType type() const
Returns a type for checking of standard errors.
Definition: tqdbuserror.h:307
TQT_DBusError::TimedOut
@ TimedOut
An operation timed out.
Definition: tqdbuserror.h:226
TQT_DBusError::InvalidArgs
@ InvalidArgs
Caused by invalid arguments passed to a method call.
Definition: tqdbuserror.h:197