Tk Library Source Code

View Ticket
Login
Ticket UUID: 1225870
Title: [try] command
Type: RFE Version: None
Submitter: dkf Created on: 2005-06-22 21:32:48
Subsystem: control Assigned To: dgp
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2005-07-05 23:10:30
Resolution: Closed By: andreas_kupries
    Closed on: 2005-07-05 16:10:30
Description:
Here's a [try] command using the features of TIP#90,
perhaps for adding to the control package. I'm
perfectly happy with the code being published under the
normal tcllib license.

proc try {script args} {
    upvar 1 try___msg msg try___opts opts
    if {[llength $args]!=0 && [llength $args]!=2} {
return -code error "wrong \# args: should be \"try
script ?finally script?\""
    }
    if {[llength $args] == 2} {
if {[lindex $args 0] ne "finally"} {
    return -code error "mis-spelt \"finally\" keyword"
}
    }
    set code [uplevel 1 [list catch $script try___msg
try___opts]]
    if {[llength $args] == 2} {
uplevel 1 [lindex $args 1]
    }
    if {$code} {
dict incr opts -level 1
return -options $opts $msg
    }
    return $msg
}
User Comments: andreas_kupries added on 2005-07-05 23:10:30:
Logged In: YES 
user_id=75003

Closed as duplicate, requested by Don.
The original RFE is

http://sourceforge.net/tracker/index.php?func=detail&aid=1225868&group_id=12883&atid=362883