pragmatism first

THROW(3TCL) - Linux manual page online | Library functions

Generate a machine-readable error.

throw(3tcl) Tcl Built-In Commands throw(3tcl) _________________________________________________________________________________________________


throw - Generate a machine-readable error


throw type message _________________________________________________________________________________________________


This command causes the current evaluation to be unwound with an error. The error created is described by the type and message arguments: type must contain a list of words describ‐ ing the error in a form that is machine-readable (and which will form the error-code part of the result dictionary), and message should contain text that is intended for display to a human being. The stack will be unwound until the error is trapped by a suitable catch or try command. If it reaches the event loop without being trapped, it will be reported through the bger‐ ror mechanism. If it reaches the top level of script evaluation in tclsh, it will be printed on the console before, in the non-interactive case, causing an exit (the behavior in other programs will depend on the details of how Tcl is embedded and used). By convention, the words in the type argument should go from most general to most spe‐ cific.


The following produces an error that is identical to that produced by expr when trying to divide a value by zero. throw {ARITH DIVZERO {divide by zero}} {divide by zero}


catch(3tcl), error(3tcl), errorCode(3tcl), errorInfo(3tcl), return(3tcl), try(3tcl)


error, exception
Tcl 8.6 throw(3tcl)
This manual Reference Other manuals
throw(3tcl) referred by return(3tcl) | tcllib_throw(3tcl) | tcllib_try(3tcl) | try(3tcl)
refer to argc(3tcl) | catch(3tcl) | error(3tcl) | return(3tcl) | try(3tcl)
Download raw manual
Index Tcl Built-In Commands (+154) Tcl (+812) № 3 (+68044)
Go top