2010-04-03 14:39:32 +00:00
|
|
|
# Basic exception throwing.
|
2010-02-18 00:29:37 +00:00
|
|
|
block: -> (throw 'up')
|
2010-04-03 14:39:32 +00:00
|
|
|
throws block, 'up'
|
|
|
|
|
|
|
|
|
|
|
|
# Basic try/catch.
|
|
|
|
result: try
|
|
|
|
10
|
|
|
|
finally
|
|
|
|
15
|
|
|
|
|
|
|
|
ok result is 10
|
|
|
|
|
|
|
|
result: try
|
|
|
|
throw 'up'
|
|
|
|
catch err
|
|
|
|
err.length
|
|
|
|
|
2010-06-28 12:50:44 +00:00
|
|
|
ok result is 2
|
|
|
|
|
|
|
|
|
2010-06-28 12:52:13 +00:00
|
|
|
result: try throw 'error' catch err then err.length
|
2010-06-28 12:50:44 +00:00
|
|
|
|
2010-07-01 00:53:09 +00:00
|
|
|
ok result is 5
|
|
|
|
|
|
|
|
|
|
|
|
# try/catch with empty clauses still compiles.
|
|
|
|
try
|
|
|
|
# nothing
|
|
|
|
catch err
|
2010-07-04 16:50:04 +00:00
|
|
|
# nothing
|
|
|
|
|
|
|
|
try
|
|
|
|
# nothing
|
|
|
|
finally
|
|
|
|
# nothing
|
|
|
|
|
2010-07-14 03:33:59 +00:00
|
|
|
try
|
|
|
|
catch err
|
|
|
|
finally
|
|
|
|
|
2010-07-04 16:50:04 +00:00
|
|
|
ok yes
|