1 | package require macports |
---|
2 | package require macports_util |
---|
3 | |
---|
4 | proc test1 {} { |
---|
5 | try { |
---|
6 | error foo |
---|
7 | } catch {{*} eCode eMessage} { |
---|
8 | error "There was an error: $eMessage" |
---|
9 | } |
---|
10 | } |
---|
11 | |
---|
12 | proc test2 {} { |
---|
13 | try { |
---|
14 | error foo |
---|
15 | } catch {{*} eCode eMessage} { |
---|
16 | return -code error "There was an error: $eMessage" |
---|
17 | } |
---|
18 | } |
---|
19 | |
---|
20 | if {[catch {test1} result]} { |
---|
21 | puts "test1 errored: $result" |
---|
22 | } else { |
---|
23 | puts "no error for test1" |
---|
24 | } |
---|
25 | |
---|
26 | if {[catch {test2} result]} { |
---|
27 | puts "test2 errored: $result" |
---|
28 | } else { |
---|
29 | puts "no error for test2" |
---|
30 | } |
---|