bug in 8.4.14 return -code error?



I'm seeing what looks like buggy behavior with "return -code error" in 8.4.14. Is this familiar to anyone, and can anyone else reproduce the buggy behavior?

In the code at the end of this post, running under 8.4.14 on windows, I get the following output:

error reported via return:
errorCode: NULL
errorInfo:

error reported via error:
errorCode: CUSTOM errorCode
errorInfo: custom errorInfo

When I run the same code with 8.5a4, the errorCode and errorInfo is identical in both cases (specifically, they both resemble what is reported via error in the above output)

The code:

proc main {} {
foo return
foo error
}

proc foo {what} {
set ::errorCode NULL
set ::errorInfo ""
if {[catch {
if {$what == "error"} {
error \
"error reported via error" \
"custom errorInfo" \
[list CUSTOM errorCode]

} else {
return \
-code error \
-errorinfo "custom errorInfo" \
-errorcode [list CUSTOM errorCode] \
"error reported via return"
}
} err]} {
puts $err:
puts " errorCode: $::errorCode"
puts " errorInfo: $::errorInfo"
puts ""
}
}
main
exit 0



--
Bryan Oakley
www.tclscripting.com
.