Skip to content
Tcl Source Code View Ticket
Login

View Ticket

error command faile to set errorCode

Closed / Invalid1246399fffffffffffffffffffffffffffffffffCreated 21 years agoUpdated 21 years ago
Descriptionplain2005-07-27 23:01:01
I am currrently using tcl 8.4.9 with Itcl 3.2.  My
program throws an error with error code inside one of
the itcl object method.  However, the errorcode in the
global scope did not get updated.


#Error code in tcl 
saveErrorCode - NONE

#tclCmdAH.c:563 for tcl8.4.9 with Itcl 3.2
errorCode = TOOMANYWIRETYPE

#Error code in tcl 
saveErrorCode - NONE

proc saveErrorCode {name index op} {
puts "saveErrorCode - [set $name]"
}

trace variable errorCode rwu saveErrorCode

# trace is generated
if {[catch {$a run $xmlf} msg]} {
...
}

I changed tclCmdAH.c:563 from
Tcl_SetVar2Ex(interp, "errorCode", NULL, objv[3],
TCL_GLOBAL_ONLY);

to

Tcl_ObjSetVar2(interp, iPtr->execEnvPtr->errorCode,
NULL, objv[3], TCL_GLOBAL_ONLY);


The trace changed to
#Error code in tcl
saveErrorCode - NONE

#tclCmdAH.c:563 for tcl8.4.9 with Itcl 3.2
errorCode = TOOMANYWIRETYPE

#Error code in tcl
saveErrorCode - TOOMANYWIRETYPE
dkf Ticket [1246399fff]: 1 change [History diff]2005-07-28 14:53:16
alvinpleungplain2005-07-29 02:23:00
Logged In: YES 
user_id=958624

My test case was not clean, so the fix does not work. 
However, the bug is real.  As far as I know, the bug only
appears if I use Itcl 3.2.1 and tclXML 3.0 packages
togather.  I will update this bug, when I know more.
dgpplain2005-07-29 04:38:50
Logged In: YES 
user_id=80530


I can't make sense out of this report.

Please open another one, and include
a script that demonstrates the bug.

Your [saveErrorCode] proc looks buggy too,
failing to use [uplevel] or [upvar] to examine
the traced variable in the original context.
Log in (anonymous is fine) to add a comment.