index.html
Main Page
|
modules.html
Modules
|
namespaces.html
Namespace List
|
hierarchy.html
Class Hierarchy
|
annotated.html
Data Structures
|
dirs.html
Directories
|
files.html
File List
|
namespacemembers.html
Namespace Members
|
functions.html
Data Fields
|
pages.html
Related Pages
Error reporting
[
group__DBus.html
D-BUS low-level public API
]
Error reporting.
#_details
More...
Functions
void
group__DBusErrors.html#ga0
dbus_error_init
(
structDBusError.html
DBusError
*error)
Initializes a
structDBusError.html
DBusError
structure.
#ga0
void
group__DBusErrors.html#ga1
dbus_error_free
(
structDBusError.html
DBusError
*error)
Frees an error that's been set (or just initialized), then reinitializes the error as in
group__DBusErrors.html#ga0
dbus_error_init()
.
#ga1
void
group__DBusErrors.html#ga2
dbus_set_error_const
(
structDBusError.html
DBusError
*error, const char *name, const char *message)
Assigns an error name and message to a
structDBusError.html
DBusError
.
#ga2
void
group__DBusErrors.html#ga3
dbus_move_error
(
structDBusError.html
DBusError
*src,
structDBusError.html
DBusError
*dest)
Moves an error src into dest, freeing src and overwriting dest.
#ga3
group__DBusTypes.html#ga2
dbus_bool_t
group__DBusErrors.html#ga4
dbus_error_has_name
(const
structDBusError.html
DBusError
*error, const char *name)
Checks whether the error is set and has the given name.
#ga4
group__DBusTypes.html#ga2
dbus_bool_t
group__DBusErrors.html#ga5
dbus_error_is_set
(const
structDBusError.html
DBusError
*error)
Checks whether an error occurred (the error is set).
#ga5
void
group__DBusErrors.html#ga6
dbus_set_error
(
structDBusError.html
DBusError
*error, const char *name, const char *format,...)
Assigns an error name and message to a
structDBusError.html
DBusError
.
#ga6
Detailed Description
Error reporting.
Types and functions related to reporting errors.
In essence D-BUS error reporting works as follows:
structDBusError.html
DBusError
error;
group__DBusErrors.html#ga0
dbus_error_init
(&error);
dbus_some_function (arg1, arg2, &error);
if
(
group__DBusErrors.html#ga5
dbus_error_is_set
(&error))
{
fprintf (stderr,
"an error occurred: %s\n"
, error.message);
group__DBusErrors.html#ga1
dbus_error_free
(&error);
}
There are some rules. An error passed to a D-BUS function must always be unset; you can't pass in an error that's already set. If a function has a return code indicating whether an error occurred, and also a
structDBusError.html
DBusError
parameter, then the error will always be set if and only if the return code indicates an error occurred. i.e. the return code and the error are never going to disagree.
An error only needs to be freed if it's been set, not if it's merely been initialized.
You can check the specific error that occurred using
group__DBusErrors.html#ga4
dbus_error_has_name()
.
Function Documentation
void dbus_error_free
(
structDBusError.html
DBusError
*
error
)
Frees an error that's been set (or just initialized), then reinitializes the error as in
group__DBusErrors.html#ga0
dbus_error_init()
.
Parameters:
error
memory where the error is stored.
Definition at line
dbus-errors_8c-source.html#l00174
174
of file
dbus-errors_8c-source.html
dbus-errors.c
.
References
dbus-errors_8c-source.html#l00046
DBusRealError::const_message
,
dbus-errors_8c-source.html#l00151
dbus_error_init()
,
dbus-memory_8c-source.html#l00612
dbus_free()
,
dbus-errors_8c-source.html#l00044
DBusRealError::message
, and
group__DBusMacros.html#ga4
NULL
.
Referenced by
dbus-keyring_8c-source.html#l00715
_dbus_keyring_new_homedir()
,
dbus-gmain_8c-source.html#l00709
dbus_g_bus_get()
,
dbus-errors_8c-source.html#l00237
dbus_move_error()
, and
connection_8cpp-source.html#l00049
Connection::Private::setConnection()
.
group__DBusTypes.html#ga2
dbus_bool_t
dbus_error_has_name
(
const
structDBusError.html
DBusError
*
error
,
const char *
name
)
Checks whether the error is set and has the given name.
Parameters:
error
the error
name
the name
Returns:
group__DBusMacros.html#ga2
TRUE
if the given named error occurred
Definition at line
dbus-errors_8c-source.html#l00260
260
of file
dbus-errors_8c-source.html
dbus-errors.c
.
References
dbus-internals_8h-source.html#l00100
_dbus_assert
,
dbus-string_8c-source.html#l02056
_dbus_string_equal()
,
dbus-string_8c-source.html#l00208
_dbus_string_init_const()
,
group__DBusMacros.html#ga3
FALSE
,
dbus-errors_8h-source.html#l00044
DBusError::message
,
dbus-errors_8h-source.html#l00043
DBusError::name
, and
group__DBusMacros.html#ga4
NULL
.
void dbus_error_init
(
structDBusError.html
DBusError
*
error
)
Initializes a
structDBusError.html
DBusError
structure.
Does not allocate any memory; the error only needs to be freed if it is set at some point.
Parameters:
error
the
structDBusError.html
DBusError
.
Definition at line
dbus-errors_8c-source.html#l00151
151
of file
dbus-errors_8c-source.html
dbus-errors.c
.
References
dbus-internals_8h-source.html#l00100
_dbus_assert
,
dbus-errors_8c-source.html#l00046
DBusRealError::const_message
,
dbus-errors_8c-source.html#l00044
DBusRealError::message
,
dbus-errors_8c-source.html#l00043
DBusRealError::name
,
group__DBusMacros.html#ga4
NULL
, and
group__DBusMacros.html#ga2
TRUE
.
Referenced by
dbus-keyring_8c-source.html#l00715
_dbus_keyring_new_homedir()
,
dbus-errors_8c-source.html#l00174
dbus_error_free()
,
dbus-gmain_8c-source.html#l00709
dbus_g_bus_get()
,
dbus-errors_8c-source.html#l00237
dbus_move_error()
, and
connection_8cpp-source.html#l00042
Connection::Private::Private()
.
group__DBusTypes.html#ga2
dbus_bool_t
dbus_error_is_set
(
const
structDBusError.html
DBusError
*
error
)
Checks whether an error occurred (the error is set).
Parameters:
error
the error object
Returns:
group__DBusMacros.html#ga2
TRUE
if an error occurred
Definition at line
dbus-errors_8c-source.html#l00287
287
of file
dbus-errors_8c-source.html
dbus-errors.c
.
References
dbus-internals_8h-source.html#l00100
_dbus_assert
,
group__DBusMacros.html#ga3
FALSE
,
dbus-errors_8h-source.html#l00044
DBusError::message
,
dbus-errors_8h-source.html#l00043
DBusError::name
, and
group__DBusMacros.html#ga4
NULL
.
Referenced by
dbus-address_8c-source.html#l00566
dbus_address_unescape_value()
, and
dbus-address_8c-source.html#l00320
dbus_parse_address()
.
void dbus_move_error
(
structDBusError.html
DBusError
*
src
,
structDBusError.html
DBusError
*
dest
)
Moves an error src into dest, freeing src and overwriting dest.
Both src and dest must be initialized. src is reinitialized to an empty error. dest may not contain an existing error. If the destination is
group__DBusMacros.html#ga4
NULL
, just frees and reinits the source error.
Parameters:
src
the source error
dest
the destination error or
group__DBusMacros.html#ga4
NULL
Definition at line
dbus-errors_8c-source.html#l00237
237
of file
dbus-errors_8c-source.html
dbus-errors.c
.
References
dbus-errors_8c-source.html#l00174
dbus_error_free()
, and
dbus-errors_8c-source.html#l00151
dbus_error_init()
.
void dbus_set_error
(
structDBusError.html
DBusError
*
error
,
const char *
name
,
const char *
format
,
...
)
Assigns an error name and message to a
structDBusError.html
DBusError
.
Does nothing if error is
group__DBusMacros.html#ga4
NULL
.
The format may be NULL, which means a default message will be deduced from the name. If the error name is unknown to D-BUS the default message will be totally useless, though.
If no memory can be allocated for the error message, an out-of-memory error message will be set instead.
todo.html#_todo000023
Todo:
should be called dbus_error_set()
Parameters:
error
the error.
name
the error name (not copied!!!)
format
printf-style format string.
Definition at line
dbus-errors_8c-source.html#l00313
313
of file
dbus-errors_8c-source.html
dbus-errors.c
.
References
dbus-internals_8h-source.html#l00100
_dbus_assert
,
dbus-string_8c-source.html#l00986
_dbus_string_append()
,
dbus-string_8c-source.html#l01191
_dbus_string_append_printf_valist()
,
dbus-string_8c-source.html#l00261
_dbus_string_free()
,
dbus-string_8c-source.html#l00174
_dbus_string_init()
,
dbus-string_8c-source.html#l00607
_dbus_string_steal_data()
,
dbus-errors_8c-source.html#l00046
DBusRealError::const_message
,
group__DBusMacros.html#ga3
FALSE
,
dbus-errors_8h-source.html#l00044
DBusError::message
,
dbus-errors_8c-source.html#l00044
DBusRealError::message
,
dbus-errors_8h-source.html#l00043
DBusError::name
,
dbus-errors_8c-source.html#l00043
DBusRealError::name
, and
group__DBusMacros.html#ga4
NULL
.
Referenced by
dbus-spawn_8c-source.html#l00633
_dbus_babysitter_set_child_exit_error()
,
dbus-sysdeps-util_8c-source.html#l00064
_dbus_become_daemon()
,
dbus-sysdeps-util_8c-source.html#l00246
_dbus_change_identity()
,
dbus-sysdeps_8c-source.html#l01168
_dbus_check_dir_is_private_to_user()
,
dbus-sysdeps_8c-source.html#l02718
_dbus_close()
,
dbus-sysdeps_8c-source.html#l00594
_dbus_connect_tcp_socket()
,
dbus-sysdeps_8c-source.html#l00394
_dbus_connect_unix_socket()
,
dbus-sysdeps_8c-source.html#l02329
_dbus_create_directory()
,
dbus-sysdeps_8c-source.html#l02256
_dbus_create_file_exclusively()
,
dbus-sysdeps-util_8c-source.html#l00310
_dbus_delete_directory()
,
dbus-sysdeps_8c-source.html#l02300
_dbus_delete_file()
,
dbus-sysdeps-util_8c-source.html#l00504
_dbus_directory_get_next_file()
,
dbus-sysdeps-util_8c-source.html#l00456
_dbus_directory_open()
,
dbus-sysdeps_8c-source.html#l02014
_dbus_file_get_contents()
,
dbus-sysdeps_8c-source.html#l02867
_dbus_full_duplex_pipe()
,
dbus-userdb-util_8c-source.html#l00043
_dbus_is_console_user()
,
dbus-keyring_8c-source.html#l00715
_dbus_keyring_new_homedir()
,
dbus-sysdeps_8c-source.html#l00673
_dbus_listen_tcp_socket()
,
dbus-sysdeps_8c-source.html#l00484
_dbus_listen_unix_socket()
,
dbus-message_8c-source.html#l01760
_dbus_message_iter_get_args_valist()
,
dbus-sysdeps_8c-source.html#l00823
_dbus_read_credentials_unix_socket()
,
dbus-server-unix_8c-source.html#l00315
_dbus_server_new_for_domain_socket()
,
dbus-server-unix_8c-source.html#l00395
_dbus_server_new_for_tcp_socket()
,
dbus-sysdeps_8c-source.html#l02745
_dbus_set_fd_nonblocking()
,
dbus-spawn_8c-source.html#l01030
_dbus_spawn_async_with_babysitter()
,
dbus-sysdeps-util_8c-source.html#l00408
_dbus_stat()
,
dbus-sysdeps_8c-source.html#l02120
_dbus_string_save_to_file()
,
dbus-transport-unix_8c-source.html#l01192
_dbus_transport_new_for_domain_socket()
,
dbus-transport-unix_8c-source.html#l01259
_dbus_transport_new_for_tcp_socket()
,
dbus-transport_8c-source.html#l00212
_dbus_transport_open()
,
dbus-userdb-util_8c-source.html#l00335
_dbus_user_database_get_groups()
,
dbus-userdb_8c-source.html#l00102
_dbus_user_database_lookup()
,
dbus-userdb-util_8c-source.html#l00189
_dbus_user_database_lookup_group()
,
dbus-sysdeps-util_8c-source.html#l00189
_dbus_write_pid_file()
,
dbus-bus_8c-source.html#l00328
dbus_bus_get()
,
dbus-address_8c-source.html#l00320
dbus_parse_address()
,
dbus-server_8c-source.html#l00486
dbus_server_listen()
,
dbus-message_8c-source.html#l03074
dbus_set_error_from_message()
,
dbus-signature_8c-source.html#l00207
dbus_signature_validate()
, and
dbus-signature_8c-source.html#l00229
dbus_signature_validate_single()
.
void dbus_set_error_const
(
structDBusError.html
DBusError
*
error
,
const char *
name
,
const char *
message
)
Assigns an error name and message to a
structDBusError.html
DBusError
.
Does nothing if error is
group__DBusMacros.html#ga4
NULL
. The message may be NULL, which means a default message will be deduced from the name. If the error name is unknown to D-BUS the default message will be totally useless, though.
todo.html#_todo000022
Todo:
should be called dbus_error_set_const()
Parameters:
error
the error.
name
the error name (not copied!!!)
message
the error message (not copied!!!)
Definition at line
dbus-errors_8c-source.html#l00201
201
of file
dbus-errors_8c-source.html
dbus-errors.c
.
References
dbus-internals_8h-source.html#l00100
_dbus_assert
,
dbus-errors_8c-source.html#l00046
DBusRealError::const_message
,
dbus-errors_8h-source.html#l00044
DBusError::message
,
dbus-errors_8c-source.html#l00044
DBusRealError::message
,
dbus-errors_8h-source.html#l00043
DBusError::name
,
dbus-errors_8c-source.html#l00043
DBusRealError::name
,
group__DBusMacros.html#ga4
NULL
, and
group__DBusMacros.html#ga2
TRUE
.
Referenced by
dbus-keyring_8c-source.html#l00971
_dbus_keyring_get_best_key()
, and
dbus-keyring_8c-source.html#l00715
_dbus_keyring_new_homedir()
.
Generated on Tue Sep 13 01:28:08 2005 for D-BUS by
http://www.doxygen.org/index.html
doxygen
1.4.4
