Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: c6bdf25a392d72ea251fd7bcb6331f3ac2baccbe
Ticket: 2935779fffffffffffffffffffffffffffffffff
Incorrect -errorline from compiled [catch]
User & Date: msofer on 2014-08-06 17:06:40
Changes

  1. assignee changed to: "dgp"
  2. closer changed to: "nobody"
  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. icomment: "Nothing much to say on this."
  5. login: "msofer"
  6. mimetype: "text/plain"
  7. severity changed to: "Minor"