Exceptions

Posted by Beetle B. on Wed 10 August 2016
exception MyException
exception AnException of int*int

raise MyException

e1 handle ex => e2
e1 handle ex(x,y) => e2

(* More generally *)
e1 handle p => e2

The type of an exception is exn.

p is a pattern. handle can have branches to match different types of exceptions.