1XSetErrorHandler(3) XLIB FUNCTIONS XSetErrorHandler(3)
2
3
4
6 XSetErrorHandler, XGetErrorText, XDisplayName, XSetIOErrorHandler,
7 XGetErrorDatabaseText - default error handlers
8
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(_Xconst char *string);
16
17 int (*XSetIOErrorHandler(int (*handler)(Display *)))();
18
19 int XGetErrorDatabaseText(Display *display, _Xconst char *name, _Xconst
20 char *message, _Xconst char *default_string, char *buf‐
21 fer_return, int length);
22
24 buffer_return
25 Returns the error description.
26
27 code Specifies the error code for which you want to obtain a
28 description.
29
30 default_string
31 Specifies the default error message if none is found in the
32 database.
33
34 display Specifies the connection to the X server.
35
36 handler Specifies the program's supplied error handler.
37
38 length Specifies the size of the buffer.
39
40 message Specifies the type of the error message.
41
42 name Specifies the name of the application.
43
44 string Specifies the character string.
45
47 Xlib generally calls the program's supplied error handler whenever an
48 error is received. It is not called on BadName errors from OpenFont,
49 LookupColor, or AllocNamedColor protocol requests or on BadFont errors
50 from a QueryFont protocol request. These errors generally are
51 reflected back to the program through the procedural interface.
52 Because this condition is not assumed to be fatal, it is acceptable for
53 your error handler to return; the returned value is ignored. However,
54 the error handler should not call any functions (directly or indi‐
55 rectly) on the display that will generate protocol requests or that
56 will look for input events. The previous error handler is returned.
57
58 The XGetErrorText function copies a null-terminated string describing
59 the specified error code into the specified buffer. The returned text
60 is in the encoding of the current locale. It is recommended that you
61 use this function to obtain an error description because extensions to
62 Xlib may define their own error codes and error strings.
63
64 The XDisplayName function returns the name of the display that
65 XOpenDisplay would attempt to use. If a NULL string is specified,
66 XDisplayName looks in the environment for the display and returns the
67 display name that XOpenDisplay would attempt to use. This makes it
68 easier to report to the user precisely which display the program
69 attempted to open when the initial connection attempt failed.
70
71 The XSetIOErrorHandler sets the fatal I/O error handler. Xlib calls
72 the program's supplied error handler if any sort of system call error
73 occurs (for example, the connection to the server was lost). This is
74 assumed to be a fatal condition, and the called routine should not
75 return. If the I/O error handler does return, the client process
76 exits.
77
78 Note that the previous error handler is returned.
79
80 The XGetErrorDatabaseText function returns a null-terminated message
81 (or the default message) from the error message database. Xlib uses
82 this function internally to look up its error messages. The text in
83 the default_string argument is assumed to be in the encoding of the
84 current locale, and the text stored in the buffer_return argument is in
85 the encoding of the current locale.
86
87 The name argument should generally be the name of your application.
88 The message argument should indicate which type of error message you
89 want. If the name and message are not in the Host Portable Character
90 Encoding, the result is implementation-dependent. Xlib uses three pre‐
91 defined “application names” to report errors. In these names, upper‐
92 case and lowercase matter.
93
94 XProtoError
95 The protocol error number is used as a string for the message
96 argument.
97
98 XlibMessage
99 These are the message strings that are used internally by the
100 library.
101
102 XRequest For a core protocol request, the major request protocol num‐
103 ber is used for the message argument. For an extension
104 request, the extension name (as given by InitExtension) fol‐
105 lowed by a period (.) and the minor request protocol number
106 is used for the message argument. If no string is found in
107 the error database, the default_string is returned to the
108 buffer argument.
109
111 XOpenDisplay(3), XSynchronize(3)
112 Xlib - C Language X Interface
113
114
115
116X Version 11 libX11 1.6.12 XSetErrorHandler(3)