Created
April 17, 2021 02:19
-
-
Save jmroot/3497646ec6841074d35620794666e57d to your computer and use it in GitHub Desktop.
try bug demo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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