NAME
XSetErrorHandler, XGetErrorText, XDisplayName, XSetIOErrorHandler, XGetErrorDatabaseText - default error handlers
SYNTAX
int (*XSetErrorHandler(int (*_h_a_n_d_l_e_r)(Display *, XErrorEvent
*)))();
int XGetErrorText(Display *_d_i_s_p_l_a_y, int _c_o_d_e, char
*_b_u_f_f_e_r___r_e_t_u_r_n, int _l_e_n_g_t_h);
char *XDisplayName(char *_s_t_r_i_n_g);
int (*XSetIOErrorHandler(int (*_h_a_n_d_l_e_r)(Display
*)))();
int XGetErrorDatabaseText(Display *_d_i_s_p_l_a_y, char *_n_a_m_e, char
*_m_e_s_s_a_g_e, char *_d_e_f_a_u_l_t___s_t_r_i_n_g, char *_b_u_f_f_e_r___r_e_t_u_r_n,
int _l_e_n_g_t_h);
ARGUMENTS
-
_b_u_f_f_e_r___r_e_t_u_r_n
Returns the error description.
-
-
_c_o_d_e
Specifies the error code for which you want to obtain a description.
-
-
_d_e_f_a_u_l_t___s_t_r_i_n_g
Specifies the default error message if none is found in the database.
-
-
_d_i_s_p_l_a_y
Specifies the connection to the X server.
-
-
_h_a_n_d_l_e_r
Specifies the program's supplied error handler.
-
-
_l_e_n_g_t_h
Specifies the size of the buffer.
-
-
_m_e_s_s_a_g_e
Specifies the type of the error message.
-
-
_n_a_m_e
Specifies the name of the application.
-
-
_s_t_r_i_n_g
Specifies the character string.
-
DESCRIPTION
Xlib generally calls the program's
supplied error handler whenever an error is received.
It is not called on
_B_a_d_N_a_m_e
errors from
_O_p_e_n_F_o_n_t,
_L_o_o_k_u_p_C_o_l_o_r,
or
_A_l_l_o_c_N_a_m_e_d_C_o_l_o_r
protocol requests or on
_B_a_d_F_o_n_t
errors from a
_Q_u_e_r_y_F_o_n_t
protocol request.
These errors generally are reflected back to the program through the
procedural interface.
Because this condition is not assumed to be fatal,
it is acceptable for your error handler to return;
the returned value is ignored.
However, the error handler should not
call any functions (directly or indirectly) on the display
that will generate protocol requests or that will look for input events.
The previous error handler is returned.
The
_X_G_e_t_E_r_r_o_r_T_e_x_t
function copies a null-terminated string describing the specified error code
into the specified buffer.
The returned text is in the encoding of the current locale.
It is recommended that you use this function to obtain an error description
because extensions to Xlib may define their own error codes
and error strings.
The
_X_D_i_s_p_l_a_y_N_a_m_e
function returns the name of the display that
_X_O_p_e_n_D_i_s_p_l_a_y
would attempt to use.
If a NULL string is specified,
_X_D_i_s_p_l_a_y_N_a_m_e
looks in the environment for the display and returns the display name that
_X_O_p_e_n_D_i_s_p_l_a_y
would attempt to use.
This makes it easier to report to the user precisely which display the
program attempted to open when the initial connection attempt failed.
The
_X_S_e_t_I_O_E_r_r_o_r_H_a_n_d_l_e_r
sets the fatal I/O error handler.
Xlib calls the program's supplied error handler if any sort of system call
error occurs (for example, the connection to the server was lost).
This is assumed to be a fatal condition,
and the called routine should not return.
If the I/O error handler does return,
the client process exits.
Note that the previous error handler is returned.
The
_X_G_e_t_E_r_r_o_r_D_a_t_a_b_a_s_e_T_e_x_t
function returns a null-terminated message
(or the default message) from the error message
database.
Xlib uses this function internally to look up its error messages.
The text in the default_string argument is assumed
to be in the encoding of the current locale,
and the text stored in the buffer_return argument
is in the encoding of the current locale.
The name argument should generally be the name of your application.
The message argument should indicate which type of error message you want.
If the name and message are not in the Host Portable Character Encoding,
the result is implementation-dependent.
Xlib uses three predefined ``application names'' to report errors.
In these names,
uppercase and lowercase matter.
-
XProtoError
The protocol error number is used as a string for the message argument.
-
-
XlibMessage
These are the message strings that are used internally by the library.
-
-
XRequest
For a core protocol request,
-
the major request protocol number is used for the message argument.
For an extension request,
the extension name (as given by
_I_n_i_t_E_x_t_e_n_s_i_o_n)
followed by a period (.) and the minor request protocol number
is used for the message argument.
If no string is found in the error database,
the default_string is returned to the buffer argument.
SEE ALSO
XOpenDisplay(3X11),
XSynchronize(3X11)
_X_l_i_b _- _C _L_a_n_g_u_a_g_e _X _I_n_t_e_r_f_a_c_e