summaryrefslogtreecommitdiff
path: root/test/ocaml/trycatch/tc.sail
blob: f788305d874aacecfb3c4b513cca34d9f0686a75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
scattered union exception

union clause exception = Test_int : int

union clause exception = Test_failure : string

val main : unit -> unit effect {escape}

function main () = {
  try {
    print("Before throw");
    throw(Test_failure("Caught!"));
    print("Not printed")
  } catch {
    Test_failure(msg) => print(msg),
    _ => print("Unknown exception")
  }
}

union clause exception = Test_other : unit

end exception