root/trunk/orca/tests/working/exception.r

Revision 1, 483 bytes (checked in by krobillard, 3 years ago)

Import orca & thune.

Line 
1REBOL [
2    Purpose: {Test 'disarm, 'try, 'catch, & 'throw'.}
3]
4
5
6; Old versions just print ?object?.
7; Mold in newer versions print the object values.
8print disarm try [do %file_does_not_exist]
9
10
11f: func [a] [if a > 2 [throw "too big"] "ok" ]
12print f 2
13print catch [f 2]
14print catch [f 3]
15
16
17f: func [a] [if a > 2 [throw/name "too big" 'big] "ok" ]
18print f 2
19print catch [f 2]
20print catch/name [f 3] 'big
21
22catch [
23    print catch/name [f 3] 'some
24    print "inner"
25]
26print "outter"
27
Note: See TracBrowser for help on using the browser.