1Tcl_BackgroundError(3) Tcl Library Procedures Tcl_BackgroundError(3)
2
3
4
5______________________________________________________________________________
6
8 Tcl_BackgroundError - report Tcl error that occurred in background pro‐
9 cessing
10
12 #include <tcl.h>
13
14 Tcl_BackgroundError(interp)
15
17 Tcl_Interp *interp (in) Interpreter in which the error
18 occurred.
19_________________________________________________________________
20
21
23 This procedure is typically invoked when a Tcl error occurs during
24 ``background processing'' such as executing an event handler. When
25 such an error occurs, the error condition is reported to Tcl or to a
26 widget or some other C code, and there is not usually any obvious way
27 for that code to report the error to the user. In these cases the code
28 calls Tcl_BackgroundError with an interp argument identifying the
29 interpreter in which the error occurred. At the time Tcl_BackgroundEr‐
30 ror is invoked, the interpreter's result is expected to contain an
31 error message. Tcl_BackgroundError will invoke the bgerror Tcl command
32 to report the error in an application-specific fashion. If no bgerror
33 command exists, or if it returns with an error condition, then
34 Tcl_BackgroundError reports the error itself by printing a message on
35 the standard error file.
36
37 Tcl_BackgroundError does not invoke bgerror immediately because this
38 could potentially interfere with scripts that are in process at the
39 time the error occurred. Instead, it invokes bgerror later as an idle
40 callback. Tcl_BackgroundError saves the values of the errorInfo and
41 errorCode variables and restores these values just before invoking
42 bgerror.
43
44 It is possible for many background errors to accumulate before bgerror
45 is invoked. When this happens, each of the errors is processed in
46 order. However, if bgerror returns a break exception, then all remain‐
47 ing error reports for the interpreter are skipped.
48
49
51 background, bgerror, error
52
53
54
55Tcl 7.5 Tcl_BackgroundError(3)