From: SourceForge.net <no...@so...> - 2003-05-12 20:36:50
|
Bugs item #734402, was opened at 2003-05-07 22:47 Message generated for change (Comment added) made by msofer You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=110894&aid=734402&group_id=10894 Category: 16. Commands A-H Group: None Status: Closed Resolution: Invalid Priority: 5 Submitted By: Nobody/Anonymous (nobody) Assigned to: miguel sofer (msofer) Summary: catch fails to catch error Initial Comment: catch [ error "This is an error"] Fails to catch to error in tcl 8.4.2. In tcl 8.3, this correctly caught the error. For this simple case, the obvious fix is: catch { error "This is an error" } However, the difference in behavior affects more complex scripts. -John <jr...@ar...> ---------------------------------------------------------------------- >Comment By: miguel sofer (msofer) Date: 2003-05-12 17:36 Message: Logged In: YES user_id=148712 Ah, but this distinction has nothing to do with the [catch] command - it is described in the Tcl man page Tcl.n, rule [2]: when you invoke catch [error] the error occurs during the substitution phase, *before* [catch] is called (as it is, it never gets called). Note also that the (buggy) behaviour in 8.3 was inconsistent: % info patch 8.3.4 % catch [error] 1 % set c catch; $c [error] wrong # args: should be "error message ?errorInfo? ?errorCode?" ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2003-05-11 22:01 Message: Logged In: NO The behavior may be correct, but the man page for "catch" does not indicate any distinction between "catch [ error ]" and "catch { error }". I believe that, as a minimum, the documentation of "catch" should be corrected. ---------------------------------------------------------------------- Comment By: miguel sofer (msofer) Date: 2003-05-08 09:24 Message: Logged In: YES user_id=148712 Doh ... I did have a déjà-vu feeling. ---------------------------------------------------------------------- Comment By: Don Porter (dgp) Date: 2003-05-08 01:23 Message: Logged In: YES user_id=80530 See Bug 219184. Fixed for Tcl 8.4a3. ---------------------------------------------------------------------- Comment By: miguel sofer (msofer) Date: 2003-05-07 23:28 Message: Logged In: YES user_id=148712 The described 8.4.2 behaviour is correct: catch [ error "This is an error"] is semantically equivalent to set err [ error "This is an error"] catch $err as substitution occurs before the [catch] command is invoked; as substitution raises an error, [catch] is never actually invoked. Did this really catch the error in 8.3? Could you please post the output of info patchlevel in the corresponding interpreter? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=110894&aid=734402&group_id=10894 |