Artifacts Associated With Ticket 2935779
Ticket change [cd3df63324] (rid 95857) by dzach on 2010-01-20 18:57:49:
- assignee initialized to: "dkf"
- cmimetype initialized to: "text/plain"
- comment initialized to:
The documentation states: "catch script ?resultVarName? ?optionsVarName?" ... "The value of the -errorline entry is an integer indicating which line of script was being evaluated when the error occurred." However, if one runs some [catch] code inside a proc, the -errorline integer indicates the line of the proc script that has the error and not the line of the catch script, as is stated in the doc. The following code shows the problem: proc test {} { puts inside...\[test] puts "some more text" switch {} { default { catch { puts "inside script" sdfsdf # the error } err opt } } puts $err puts $opt } % test inside...[test] some more text inside script invalid command name "sdfsdf" -code 1 -level 0 -errorcode NONE -errorinfo {invalid command name "sdfsdf" while executing "sdfsdf # the error"} -errorline 8 instead of -errorline 3 - foundin initialized to: "None"
- is_private initialized to: "0"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "dzach"
- subsystem initialized to: "16. Commands A-H"
- title initialized to: "Inaccuracy in docs for [catch] option -errorline "
- type initialized to: "Bug"
Ticket change [91a3ff2f61] (rid 120652) by dgp on 2010-01-21 09:15:50:
- assignee changed to: "dgp"
- icomment:
That's a bug then, not mistaken docs. Please state precisely what release you see this buggy behavior in, and whether or not it is a regression from earlier releases that got things right.
- login: "dgp"
- mimetype: "text/plain"
- subsystem changed to: "47. Bytecode Compiler"
- username: "dgp"
Ticket change [cfade21358] (rid 113026) by dzach on 2010-01-21 09:27:55:
- icomment:
Release: Tcl8.6b1.1 / Tk8.6b1.1 Same problem with: Tcl8.5a6 / Tk8.5a6 but not with Tcl8.4.16 / Tk8.4.16 since [catch] options were introduced in 8.5 I think.
- login: "dzach"
- mimetype: "text/plain"
- username: "dzach"
- icomment:
Ticket change [c65f2210a2] (rid 121752) by dzach on 2010-01-21 16:30:55:
- icomment:
I don't call it a bug because I find the functionality correct and as expected, only the docs say it should be different. The way it works now helps pinpoint the error line within the [proc] script, with a simple [info body].
- login: "dzach"
- mimetype: "text/plain"
- username: "dzach"
- icomment:
Ticket change [63166364a2] (rid 92516) by dgp on 2010-02-18 02:12:39:
- icomment:
Contrast these two: % proc test {} { catch { puts foo error bar } m o puts $o } % test foo -code 1 -level 0 -errorcode NONE -errorinfo {bar while executing "error bar"} -errorline 4 % proc test2 {} { set catch catch $catch { puts foo error bar } m o puts $o } % test2 foo -code 1 -level 0 -errorcode NONE -errorinfo {bar while executing "error bar"} -errorline 3 The difference is whether [catch] is compiled, and when it is, it becomes intstructions within the larger proc body script which causes GetSrcInfoForPc() to base its errorLine calculation off the wrong script start. Will get back to this one later. - login: "dgp"
- mimetype: "text/plain"
- priority changed to: "3 Low"
- username: "dgp"
- icomment:
Ticket change [efef3d5cda] (rid 109085) by duquette on 2012-08-25 00:55:12:
- icomment:
I'm seeing this bug in Tcl 8.5.9 on Mac OS X; and it simply isn't a documentation bug. Getting the errorline in the enclosing proc isn't useful.
- login: "duquette"
- mimetype: "text/plain"
- username: "duquette"
- icomment:
Ticket change [7b2f23631b] (rid 90480) by dgp on 2012-08-25 07:51:20:
- priority changed to: "8"
- title changed to: "Incorrect -errorline from compiled [catch]"
Ticket change [4fbab61cd7] (rid 125876) by dgp on 2013-03-20 01:44:35:
- assignee changed to: "msofer"
- icomment:
miguel, any thoughts on this one? Also, don't we have other commands besides [catch] that compile script bodies into inline bytecodes that would suffer the same problem?
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
Ticket change [c6bdf25a39] (rid 139159) by msofer on 2014-08-06 17:06:40:
- assignee changed to: "dgp"
- closer changed to: "nobody"
- comment changed to:
The documentation states: "catch script ?resultVarName? ?optionsVarName?" ... "The value of the -errorline entry is an integer indicating which line of script was being evaluated when the error occurred." However, if one runs some [catch] code inside a proc, the -errorline integer indicates the line of the proc script that has the error and not the line of the catch script, as is stated in the doc. The following code shows the problem: proc test {} { puts inside...\[test] puts "some more text" switch {} { default { catch { puts "inside script" sdfsdf # the error } err opt } } puts $err puts $opt } % test inside...[test] some more text inside script invalid command name "sdfsdf" -code 1 -level 0 -errorcode NONE -errorinfo {invalid command name "sdfsdf" while executing "sdfsdf # the error"} -errorline 8 instead of -errorline 3 - icomment: "Nothing much to say on this."
- login: "msofer"
- mimetype: "text/plain"
- severity changed to: "Minor"
Ticket change [2a3a6ca520] (rid 139163) by dkf on 2014-08-07 09:53:49:
- icomment:
I think it's been this was since 8.0a1, though you'll have to parse the <tt>$::errorInfo</tt> to get the line number there.
- login: "dkf"
- mimetype: "text/html"
- username: "dkf"
- icomment: