


XSetErrorHandler(3X11)				       XSetErrorHandler(3X11)
X11R5									X11R5



NAME
  XSetErrorHandler, XGetErrorText, XDisplayName, XSetIOErrorHandler, XGetEr-
  rorDatabaseText - default error handlers

SYNTAX
  int (*XSetErrorHandler(_h_a_n_d_l_e_r))()
	int (*_h_a_n_d_l_e_r)(Display *, XErrorEvent *)

  XGetErrorText(_d_i_s_p_l_a_y, _c_o_d_e, _b_u_f_f_e_r__r_e_t_u_r_n, _l_e_n_g_t_h)
	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(_s_t_r_i_n_g)
	char *_s_t_r_i_n_g;

  int (*XSetIOErrorHandler(_h_a_n_d_l_e_r))()
	int (*_h_a_n_d_l_e_r)(Display *);

  XGetErrorDatabaseText(_d_i_s_p_l_a_y, _n_a_m_e, _m_e_s_s_a_g_e,	_d_e_f_a_u_l_t__s_t_r_i_n_g,
  _b_u_f_f_e_r__r_e_t_u_r_n, _l_e_n_g_t_h)
	Display	*_d_i_s_p_l_a_y;
	char *_n_a_m_e, *_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 descrip-
	    tion.

  _d_e_f_a_u_l_t__s_t_r_i_n_g
	    Specifies the default error	message	if none	is found in the	data-
	    base.

  _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.
  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 con-
  nection 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	func-
  tion internally to look up its error messages.  The default_string is
  assumed to be	in the encoding	of the current locale.	The buffer_return
  text 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 ``applica-
  tion names'' to report errors	(uppercase and lowercase matter):

  XXPPrroottooEErrrroorr
	    The	protocol error number is used as a string for the message
	    argument.

  XXlliibbMMeessssaaggee
	    These are the message strings that are used	internally by the
	    library.

  XXRReeqquueesstt  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	delim off










