Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: cd3df63324840402c652ddafdd590d3f3a5cd806
Ticket: 2935779fffffffffffffffffffffffffffffffff
Incorrect -errorline from compiled [catch]
User & Date: dzach on 2010-01-20 18:57:49
Changes

  1. assignee changed to: "dkf"
  2. cmimetype changed to: "text/plain"
  3. 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
    
  4. foundin changed to: "None"
  5. is_private changed to: "0"
  6. priority changed to: "5 Medium"
  7. resolution changed to: "None"
  8. status changed to: "Open"
  9. submitter changed to: "dzach"
  10. subsystem changed to: "16. Commands A-H"
  11. title changed to: "Inaccuracy in docs for [catch] option -errorline "
  12. type changed to: "Bug"