1XSetErrorHandler(3)             XLIB FUNCTIONS             XSetErrorHandler(3)
2
3
4

NAME

6       XSetErrorHandler,   XGetErrorText,   XDisplayName,  XSetIOErrorHandler,
7       XGetErrorDatabaseText - default error handlers
8

SYNTAX

10       int (*XSetErrorHandler(int (*handler)(Display *, XErrorEvent *)))();
11
12       int XGetErrorText(Display *display, int code, char *buffer_return,  int
13              length);
14
15       char *XDisplayName(char *string);
16
17       int (*XSetIOErrorHandler(int (*handler)(Display *)))();
18
19       int  XGetErrorDatabaseText(Display *display, char *name, char *message,
20              char *default_string, char *buffer_return, int length);
21

ARGUMENTS

23       buffer_return
24                 Returns the error description.
25
26       code      Specifies the error code for  which  you  want  to  obtain  a
27                 description.
28
29       default_string
30                 Specifies  the  default error message if none is found in the
31                 database.
32
33       display   Specifies the connection to the X server.
34
35       handler   Specifies the program's supplied error handler.
36
37       length    Specifies the size of the buffer.
38
39       message   Specifies the type of the error message.
40
41       name      Specifies the name of the application.
42
43       string    Specifies the character string.
44

DESCRIPTION

46       Xlib generally calls the program's supplied error handler  whenever  an
47       error  is  received.  It is not called on BadName errors from OpenFont,
48       LookupColor, or AllocNamedColor protocol requests or on BadFont  errors
49       from   a  QueryFont  protocol  request.   These  errors  generally  are
50       reflected  back  to  the  program  through  the  procedural  interface.
51       Because this condition is not assumed to be fatal, it is acceptable for
52       your error handler to return; the returned value is ignored.   However,
53       the  error  handler  should  not  call any functions (directly or indi‐
54       rectly) on the display that will generate  protocol  requests  or  that
55       will look for input events.  The previous error handler is returned.
56
57       The  XGetErrorText  function copies a null-terminated string describing
58       the specified error code into the specified buffer.  The returned  text
59       is  in  the encoding of the current locale.  It is recommended that you
60       use this function to obtain an error description because extensions  to
61       Xlib may define their own error codes and error strings.
62
63       The  XDisplayName  function  returns  the  name  of  the  display  that
64       XOpenDisplay would attempt to use.  If  a  NULL  string  is  specified,
65       XDisplayName  looks  in the environment for the display and returns the
66       display name that XOpenDisplay would attempt to  use.   This  makes  it
67       easier  to  report  to  the  user  precisely  which display the program
68       attempted to open when the initial connection attempt failed.
69
70       The XSetIOErrorHandler sets the fatal I/O error  handler.   Xlib  calls
71       the  program's  supplied error handler if any sort of system call error
72       occurs (for example, the connection to the server was lost).   This  is
73       assumed  to  be  a  fatal  condition, and the called routine should not
74       return.  If the I/O error  handler  does  return,  the  client  process
75       exits.
76
77       Note that the previous error handler is returned.
78
79       The  XGetErrorDatabaseText  function  returns a null-terminated message
80       (or the default message) from the error message  database.   Xlib  uses
81       this  function  internally  to look up its error messages.  The text in
82       the default_string argument is assumed to be in  the  encoding  of  the
83       current locale, and the text stored in the buffer_return argument is in
84       the encoding of the current locale.
85
86       The name argument should generally be the  name  of  your  application.
87       The  message  argument  should indicate which type of error message you
88       want.  If the name and message are not in the Host  Portable  Character
89       Encoding, the result is implementation-dependent.  Xlib uses three pre‐
90       defined “application names” to report errors.  In these  names,  upper‐
91       case and lowercase matter.
92
93       XProtoError
94                 The protocol error number is used as a string for the message
95                 argument.
96
97       XlibMessage
98                 These are the message strings that are used internally by the
99                 library.
100
101       XRequest  For  a core protocol request, the major request protocol num‐
102                 ber is used for  the  message  argument.   For  an  extension
103                 request,  the extension name (as given by InitExtension) fol‐
104                 lowed by a period (.) and the minor request  protocol  number
105                 is  used  for the message argument.  If no string is found in
106                 the error database, the default_string  is  returned  to  the
107                 buffer argument.
108

SEE ALSO

110       XOpenDisplay(3), XSynchronize(3)
111       Xlib - C Language X Interface
112
113
114
115X Version 11                     libX11 1.6.9              XSetErrorHandler(3)
Impressum