bgerror.n

来自「tcl是工具命令语言」· N 代码 · 共 80 行

N
80
字号
'\"'\" Copyright (c) 1990-1994 The Regents of the University of California.'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.'\"'\" See the file "license.terms" for information on usage and redistribution'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.'\" '\" RCS: @(#) $Id: bgerror.n,v 1.4 2000/09/07 14:27:45 poenitz Exp $'\" .so man.macros.TH bgerror n 7.5 Tcl "Tcl Built-In Commands".BS'\" Note:  do not modify the .SH NAME line immediately below!.SH NAMEbgerror \- Command invoked to process background errors.SH SYNOPSIS\fBbgerror \fImessage\fR.BE.SH DESCRIPTION.PPThe \fBbgerror\fR command doesn't exist as built-in part of Tcl.  Instead,individual applications or users can define a \fBbgerror\fRcommand (e.g. as a Tcl procedure) if they wish to handle backgrounderrors..PPA background error is one that occurs in an event handler or someother command that didn't originate with the application.For example, if an error occurs while executing a command specifiedwith the \fBafter\fR command, then it is a background error.For a non-background error, the error can simply be returned upthrough nested Tcl command evaluations until it reaches the top-levelcode in the application; then the application can report the errorin whatever way it wishes.  When a background error occurs, theunwinding ends in the Tcl library and there is no obvious way for Tclto report the error..PPWhen Tcl detects a background error, it saves information about theerror and invokes the \fBbgerror\fR command later as an idle eventhandler. Before invoking \fBbgerror\fR, Tcl restores the\fBerrorInfo\fR and \fBerrorCode\fR variables to their values at thetime the error occurred, then it invokes \fBbgerror\fR with the errormessage as its only argument.  Tcl assumes that the application hasimplemented the \fBbgerror\fR command, and that the command willreport the error in a way that makes sense for the application.  Tclwill ignore any result returned by the \fBbgerror\fR command as longas no error is generated..PPIf another Tcl error occurs within the \fBbgerror\fR command (forexample, because no \fBbgerror\fR command has been defined) then Tclreports the error itself by writing a message to stderr..PPIf several background errors accumulate before \fBbgerror\fR isinvoked to process them, \fBbgerror\fR will be invoked once for eacherror, in the order they occurred.  However, if \fBbgerror\fR returnswith a break exception, then any remaining errors are skipped withoutcalling \fBbgerror\fR..PPTcl has no default implementation for \fBbgerror\fR. However, inapplications using Tk there is a default \fBbgerror\fR procedure whichposts a dialog box containing the error message and offers the user achance to see a stack trace showing where the error occurred.  Inaddition to allowing the user to view the stack trace, the dialogprovides an additional application configurable button which may beused, for example, to save the stack trace to a file.  By default,this is the behavior associated with that button.  This behavior canbe redefined by setting the option database values\fB*ErrorDialog.function.text\fR, to specify the caption for thefunction button, and \fB*ErrorDialog.function.command\fR, to specifythe command to be run.  The text of the stack trace is appended to thecommand when it is evaluated.  If either of these options is set tothe empty string, then the additional button will not be displayed inthe dialog..SH "SEE ALSO"after(n), tclvars(n).SH KEYWORDSbackground error, reporting

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?