diff options
author | dgp <dgp@users.sourceforge.net> | 2004-09-17 22:59:12 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2004-09-17 22:59:12 (GMT) |
commit | 943be4691a0b7e656418187abe765d4c43190d17 (patch) | |
tree | 5d34faf294f095a400e608bc71536e1ee5249533 /generic/tclBasic.c | |
parent | 4ce4e4d5af827805c97d9f0c2a3d2953922f15d0 (diff) | |
download | tcl-943be4691a0b7e656418187abe765d4c43190d17.zip tcl-943be4691a0b7e656418187abe765d4c43190d17.tar.gz tcl-943be4691a0b7e656418187abe765d4c43190d17.tar.bz2 |
* generic/tclBasic.c (Tcl_AddObjErrorInfo, Tcl_LogCommandInfo):
* generic/tclCmdAH.c ([catch], [error]):
* generic/tclCmdMZ.c ([return]):
* generic/tclProc.c (TclUpdateReturnInfo):
* generic/tclResult.c (Tcl_SetErrorCodeVA, Tcl_SetObjErrorCode
TclTransferResult): Refactored so that all errorCode setting
flows through Tcl_SetObjErrorCode(). This greatly reduces the
number of different places in the code that need to know details
about an internal bitflag field of the Interp struct. Also
places errorCode setting in one place for easier future mods.
Diffstat (limited to 'generic/tclBasic.c')
-rw-r--r-- | generic/tclBasic.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 83bc4a6..f6e5235 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclBasic.c,v 1.113 2004/09/08 17:04:01 dgp Exp $ + * RCS: @(#) $Id: tclBasic.c,v 1.114 2004/09/17 22:59:14 dgp Exp $ */ #include "tclInt.h" @@ -3308,6 +3308,9 @@ Tcl_LogCommandInfo(interp, script, command, length) Tcl_AppendToObj(message, "\"", -1); TclAppendObjToErrorInfo(interp, message); Tcl_DecrRefCount(message); + if (!(iPtr->flags & ERROR_CODE_SET)) { + Tcl_SetErrorCode(interp, "NONE", NULL); + } iPtr->flags &= ~ERR_ALREADY_LOGGED; } @@ -4766,11 +4769,15 @@ Tcl_AddObjErrorInfo(interp, message, length) /* * If the errorCode variable wasn't set by the code that generated * the error, set it to "NONE". + * + * NOTE: The main check for setting the default value of + * errorCode to NONE is in Tcl_LogCommandInfo. This one + * should go away, but currently it's taking care of setting + * up errorCode after compile errors. */ if (!(iPtr->flags & ERROR_CODE_SET)) { - Tcl_ObjSetVar2(interp, iPtr->execEnvPtr->errorCode, NULL, - Tcl_NewStringObj("NONE", -1), TCL_GLOBAL_ONLY); + Tcl_SetErrorCode(interp, "NONE", NULL); } } |