| 1 |
# Copyright (c) 1992-1994 The Regents of the University of California. |
| 2 |
# Copyright (c) 1994 Sun Microsystems, Inc. |
| 3 |
# See the file "license.terms" for information on usage and redistribution |
| 4 |
# of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
| 5 |
# |
| 6 |
# @(#) BackgdErr.3 1.6 95/05/06 15:29:07 |
| 7 |
# |
| 8 |
|
| 9 |
=head1 NAME |
| 10 |
|
| 11 |
Tk_BackgroundError - report Tcl error that occurred in background processing |
| 12 |
|
| 13 |
=for category C Programming |
| 14 |
|
| 15 |
=head1 SYNOPSIS |
| 16 |
|
| 17 |
B<#include E<lt>tk.hE<gt>> |
| 18 |
|
| 19 |
B<Tk_BackgroundError>(I<interp>) |
| 20 |
|
| 21 |
=head1 ARGUMENTS |
| 22 |
|
| 23 |
=over 4 |
| 24 |
|
| 25 |
=item Tcl_Interp *interp (in) |
| 26 |
|
| 27 |
Interpreter in which the error occurred. |
| 28 |
|
| 29 |
=back |
| 30 |
|
| 31 |
=head1 DESCRIPTION |
| 32 |
|
| 33 |
This procedure is typically invoked when a Tcl error occurs during |
| 34 |
``background processing'' such as executing a Tcl command in response |
| 35 |
to a button press or menu entry invocation. |
| 36 |
When such an error occurs, the error condition is reported to Tk |
| 37 |
or to a widget or some other C code, and there is not usually any |
| 38 |
obvious way for that code to report the error to the user. |
| 39 |
In these cases the code calls B<Tk_BackgroundError> with an |
| 40 |
I<interp> argument identifying the interpreter in which the |
| 41 |
error occurred. |
| 42 |
B<Tk_BackgroundError> attempts to invoke the B<tkerror> |
| 43 |
Tcl command to report the error in an application-specific fashion. |
| 44 |
If no B<tkerror> command exists, or if it returns with an error condition, |
| 45 |
then B<Tk_BackgroundError> reports the error itself by printing |
| 46 |
a message on the standard error file. |
| 47 |
|
| 48 |
B<Tk_BackgroundError> does not invoke B<tkerror> immediately |
| 49 |
(in some cases this could interfere with scripts that are in process |
| 50 |
at the time the error occurred). |
| 51 |
Instead, it invokes B<tkerror> later as an idle callback. |
| 52 |
B<Tk_BackgroundError> saves the values of the B<errorInfo> and |
| 53 |
B<errorCode> variables and restores these values just before |
| 54 |
invoking B<tkerror>. |
| 55 |
|
| 56 |
It is possible for many background errors to accumulate before |
| 57 |
B<tkerror> is invoked. When this happens, each of the errors |
| 58 |
is processed in order. However, if B<tkerror> returns a |
| 59 |
break exception, then all remaining error reports for the |
| 60 |
interpreter are skipped. |
| 61 |
|
| 62 |
=head1 KEYWORDS |
| 63 |
|
| 64 |
background, error, tkerror |