Skip to content

Instantly share code, notes, and snippets.

@jmroot
Created April 17, 2021 02:19
Show Gist options
  • Select an option

  • Save jmroot/3497646ec6841074d35620794666e57d to your computer and use it in GitHub Desktop.

Select an option

Save jmroot/3497646ec6841074d35620794666e57d to your computer and use it in GitHub Desktop.
try bug demo
package require macports
package require macports_util
proc test1 {} {
try {
error foo
} catch {{*} eCode eMessage} {
error "There was an error: $eMessage"
}
}
proc test2 {} {
try {
error foo
} catch {{*} eCode eMessage} {
return -code error "There was an error: $eMessage"
}
}
if {[catch {test1} result]} {
puts "test1 errored: $result"
} else {
puts "no error for test1"
}
if {[catch {test2} result]} {
puts "test2 errored: $result"
} else {
puts "no error for test2"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment