bgerror man page on QNX

Man page or keyword search:  
man Server   4347 pages
apropos Keyword Search (all sections)
Output format
QNX logo
[printable version]

bgerror(n)		     Tcl Built-In Commands		    bgerror(n)


       bgerror - Command invoked to process background errors

       bgerror message

       The  bgerror  command  doesn't exist as built-in part of Tcl.  Instead,
       individual applications or users can define a bgerror command (e.g.  as
       a Tcl procedure) if they wish to handle background errors.

       A background error is one that occurs in an event handler or some other
       command that didn't originate with the application.  For example, if an
       error  occurs  while  executing a command specified with the after com‐
       mand, then it is a background error.  For a non-background  error,  the
       error  can simply be returned up through nested Tcl command evaluations
       until it reaches the top-level code in the application; then the appli‐
       cation  can  report  the error in whatever way it wishes.  When a back‐
       ground error occurs, the unwinding ends in the Tcl library and there is
       no obvious way for Tcl to report the error.

       When  Tcl  detects  a  background error, it saves information about the
       error and invokes the bgerror command later as an idle  event  handler.
       Before invoking bgerror, Tcl restores the errorInfo and errorCode vari‐
       ables to their values at the time the error occurred, then  it  invokes
       bgerror	with the error message as its only argument.  Tcl assumes that
       the application has implemented the bgerror command, and that the  com‐
       mand  will  report the error in a way that makes sense for the applica‐
       tion.  Tcl will ignore any result returned by the  bgerror  command  as
       long as no error is generated.

       If  another  Tcl	 error occurs within the bgerror command (for example,
       because no bgerror command has been defined) then Tcl reports the error
       itself by writing a message to stderr.

       If  several  background	errors accumulate before bgerror is invoked to
       process them, bgerror will be invoked once for each error, in the order
       they  occurred.	 However,  if  bgerror returns with a break exception,
       then any remaining errors are skipped without calling bgerror.

       Tcl has no default implementation for bgerror. However, in applications
       using  Tk there is a default bgerror procedure which posts a dialog box
       containing the error message and offers the user	 a  chance  to	see  a
       stack  trace showing where the error occurred.  In addition to allowing
       the user to view the stack trace, the  dialog  provides	an  additional
       application configurable button which may be used, for example, to save
       the stack trace to a file.  By default, this is the behavior associated
       with that button.  This behavior can be redefined by setting the option
       database values *ErrorDialog.function.text, to specify the caption  for
       the  function button, and *ErrorDialog.function.command, to specify the
       command to be run.  The text of the stack trace is appended to the com‐
       mand  when  it  is evaluated.  If either of these options is set to the
       empty string, then the additional button will not be displayed  in  the

       If  you are writing code that will be used by others as part of a pack‐
       age or other kind of library, consider avoiding	bgerror.   The	reason
       for  this  is that the application programmer may also want to define a
       bgerror, or use other code that does and thus will have	trouble	 inte‐
       grating your code.

       This bgerror procedure appends errors to a file, with a timestamp.
	      proc bgerror {message} {
		  set timestamp [clock format [clock seconds]]
		  set fl [open mylog.txt {WRONLY CREAT APPEND}]
		  puts $fl "$timestamp: bgerror in $::argv '$message'"
		  close $fl

       after(n), tclvars(n)

       background error, reporting

Tcl				      7.5			    bgerror(n)
                             _         _         _ 
                            | |       | |       | |     
                            | |       | |       | |     
                         __ | | __ __ | | __ __ | | __  
                         \ \| |/ / \ \| |/ / \ \| |/ /  
                          \ \ / /   \ \ / /   \ \ / /   
                           \   /     \   /     \   /    
                            \_/       \_/       \_/ 
More information is available in HTML format for server QNX

List of man pages available for QNX

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
Vote for polarhome
Free Shell Accounts :: the biggest list on the net