class MyErr1: Exception("Something went wrong")
class MyErr2(msg: Str): Exception(msg)
def f(x: Int) -> Int raise [MyErr1, MyErr2] =>
if x < 0 then
raise MyErr1()
else
if x > 10 then
raise MyErr2("Greater than 10.")
else
return x + 2
def a := f(10) handle
err: MyErr1 =>
print("Something went wrong")
-1
err: MyErr2 =>
print("Something else went wrong")
-2