<HTML><HEAD><TITLE>Tcl Library Procedures - Tcl_BackgroundError manual page</TITLE></HEAD><BODY> <H3><A NAME="M2">NAME</A></H3> Tcl_BackgroundError - report Tcl error that occurred in background processing <H3><A NAME="M3">SYNOPSIS</A></H3> <B>#include <tcl.h></B><BR> <B>Tcl_BackgroundError</B>(<I>interp</I>)<BR> <H3><A NAME="M4">ARGUMENTS</A></H3> <DL> <P><DT><A HREF="../TclLib/Interp.htm">Tcl_Interp</A> <B>*interp</B> (in)<DD> Interpreter in which the error occurred. <P></DL> <H3><A NAME="M5">DESCRIPTION</A></H3> This procedure is typically invoked when a Tcl error occurs during ``background processing'' such as executing an event handler. When such an error occurs, the error condition is reported to Tcl or to a widget or some other C code, and there is not usually any obvious way for that code to report the error to the user. In these cases the code calls <B>Tcl_BackgroundError</B> with an <I>interp</I> argument identifying the interpreter in which the error occurred. At the time <B>Tcl_BackgroundError</B> is invoked, <I>interp->result</I> is expected to contain an error message. <B>Tcl_BackgroundError</B> will invoke the <B><A HREF="../TclCmd/bgerror.htm">bgerror</A></B> Tcl command to report the error in an application-specific fashion. If no <B><A HREF="../TclCmd/bgerror.htm">bgerror</A></B> command exists, or if it returns with an error condition, then <B>Tcl_BackgroundError</B> reports the error itself by printing a message on the standard error file. <P> <B>Tcl_BackgroundError</B> does not invoke <B><A HREF="../TclCmd/bgerror.htm">bgerror</A></B> immediately because this could potentially interfere with scripts that are in process at the time the error occurred. Instead, it invokes <B><A HREF="../TclCmd/bgerror.htm">bgerror</A></B> later as an idle callback. <B>Tcl_BackgroundError</B> saves the values of the <B>errorInfo</B> and <B>errorCode</B> variables and restores these values just before invoking <B><A HREF="../TclCmd/bgerror.htm">bgerror</A></B>. <P> It is possible for many background errors to accumulate before <B><A HREF="../TclCmd/bgerror.htm">bgerror</A></B> is invoked. When this happens, each of the errors is processed in order. However, if <B><A HREF="../TclCmd/bgerror.htm">bgerror</A></B> returns a break exception, then all remaining error reports for the interpreter are skipped. <H3><A NAME="M6">KEYWORDS</A></H3> <A href="../Keywords/B.htm#background">background</A>, <A href="../Keywords/B.htm#bgerror">bgerror</A>, <A href="../Keywords/E.htm#error">error</A> <HR><PRE> <A HREF="../copyright.htm">Copyright</A> © 1992-1994 The Regents of the University of California. <A HREF="../copyright.htm">Copyright</A> © 1994-1996 Sun Microsystems, Inc. <A HREF="../copyright.htm">Copyright</A> © 1995-1997 Roger E. Critchlow Jr.</PRE> </BODY></HTML>