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