Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 6c4144718aec18668e53ae0ece9777cb8116f597
Ticket: 219150ffffffffffffffffffffffffffffffffff
"catch" doesn't catch "expr" syntax errors
User & Date: nobody on 2000-10-26 05:02:20
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    OriginalBugID: 1149 Bug
    Version: 8.1b1
    SubmitDate: '1999-02-02'
    LastModified: '2000-05-19'
    Severity: MED
    Status: Assigned
    Submitter: pat
    ChangedBy: hobbs
    RelatedBugIDs: 2248
    OS: Linux
    Machine: Other
    FixedDate: '1999-04-09'
    ClosedDate: '2000-10-25'
    
    
    Name:
    Steve McAndrewSmith
    
    ReproducibleScript:
    # These work fine
    catch { expr 1+1 }  ;# no error
    catch { someundefinedproc } ;# error, but caught
    
    # These don't! (the error is never caught)
    catch { expr 1+- }
    catch { expr int(abc) }
    
    
    
    ObservedBehavior:
    When "expr" generates a syntax error, it is not caught by the "catch" command.
    
    
    
    DesiredBehavior:
    Duh. :-)  Catch should behave the same for "expr" as for any other error.
    
    
    
    
    03/24/1999 14:23 - stanton - This is the expected (if non-obvious) behavior.  The syntax error is detected during compilation of the catch command, so it cannot be masked.  This is a change from 8.0 and should be documented more clearly.
    ---
    04/09/1999 14:43 - surles - Added necessary documentation and an example.
    --
    This was originally noted fixed in 8.1b3, but it is actually a bug,
    not a doc problem.  The work-around is to do:
        set cmd {expr 1+-}
        catch $cmd 
    -- 05/19/2000 hobbs
    
    
    
  4. foundin changed to: "obsolete: 8.1b1"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "nobody"
  9. subsystem changed to: "10. Objects"
  10. title changed to: ""catch" doesn't catch "expr" syntax errors"
  11. type changed to: "Bug"