This method provides a uniform way to report errors in the compiled code.
{\bfseries{}tcl.resultf}("cmd = %s", cmd); {\bfseries{}tcl.error}("invalid command specified"); /*{}NOTREACHED*/
Note that there are minor differences between returning TCL_ERROR as we did in the previous subsectionSectionsec:Result, and calling []Tcl::error. The former generates an exception within the interpreter; the user can trap the exception and possibly recover from the error. If the user has not specified any traps, the interpreter will print a stack trace and exit. However, if the code invokes []error, then the simulation user cannot trap the error; in addition, ns will not print any stack trace.