This commit is contained in:
Ingy döt Net 2013-04-10 16:57:12 -07:00
parent 518da4a923
commit 764da6cbbb
6144 changed files with 83610 additions and 11 deletions

View file

@ -0,0 +1,2 @@
do {- ... -}
throwIO SomeException

View file

@ -0,0 +1,2 @@
if condition then 3
else throw SomeException

View file

@ -0,0 +1,2 @@
if condition then 3
else throwDyn myException

View file

@ -0,0 +1,4 @@
do
{- do IO computations here -}
`catch` \ex -> do
{- handle exception "ex" here -}

View file

@ -0,0 +1,4 @@
do
{- do IO computations here -}
`catchDyn` \ex -> do
{- handle exception "ex" here -}

View file

@ -0,0 +1,17 @@
import Exceptions
procedure main(A)
every i := !A do {
case Try().call{ write(g(i)) } of {
Try().catch(): {
x := Try().getException()
write(x.getMessage(), ":\n", x.getLocation())
}
}
}
end
procedure g(i)
if numeric(i) = 3 then Exception().throw("bad value of "||i)
return i
end