From: SourceForge.net <no...@so...> - 2008-10-02 22:07:37
|
Bugs item #2142989, was opened at 2008-10-02 16:32 Message generated for change (Comment added) made by msofer You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=110894&aid=2142989&group_id=10894 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open >Resolution: None >Priority: 3 Private: No Submitted By: Nobody/Anonymous (nobody) >Assigned to: miguel sofer (msofer) >Summary: add examples to the [catch] man page Initial Comment: I use tcl-8.5.4. In the following code 'catch' returns 1 indicating an error but '::errorInfo' isn't set, producing 'no such variable' message. --- testcase --- proc c {} {} proc main {} { if {[catch { return [c] }]} { puts "ERROR: *$::errorInfo* *************" } } main --- output ---- can't read "::errorInfo": no such variable while executing "puts "ERROR: *$::errorInfo* *************"" ---------------------------------------------------------------------- >Comment By: miguel sofer (msofer) Date: 2008-10-02 19:07 Message: Catch can return a lot of other codes - essentially, any 32-bit integer value: % catch {return -code 1234 -level 0} 1234 If you have a suggestion on how to improve the man page and examples, please add it here. ---------------------------------------------------------------------- Comment By: Yuri (yurivict) Date: 2008-10-02 18:43 Message: Makes sense: 'catch' has 5 possible return values (0..4). Then I suggest you add another example of basic 'catch' usage in EXAMPLES section of catch(n) demonstrating all 5 return values. Otherwise people look at the example (if {[catch...]} {...exit...}) and get misled by it's simplicity. ---------------------------------------------------------------------- Comment By: miguel sofer (msofer) Date: 2008-10-02 16:46 Message: Wrong diagnostic: [catc] is not returning 1 (error) but 2 (return); no error, no errorInfo ... mig@oli:~$ tclsh % proc c {} {} % catch {return [c]} 2 ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=110894&aid=2142989&group_id=10894 |