#3199 error command faile to set errorCode

obsolete: 8.4.9
closed-invalid
Don Porter
5
2014-08-12
2005-07-27
Alvin Leung
No

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

Discussion

    • assigned_to: dkf --> dgp
     
  • Alvin Leung
    Alvin Leung
    2005-07-28

    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.

     
  • Don Porter
    Don Porter
    2005-07-28

    • milestone: --> obsolete: 8.4.9
    • status: open --> closed-invalid
     
  • Don Porter
    Don Porter
    2005-07-28

    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.