diff options
Diffstat (limited to 'core/errors.nom')
| -rw-r--r-- | core/errors.nom | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/core/errors.nom b/core/errors.nom index 2744208..53b06a2 100644 --- a/core/errors.nom +++ b/core/errors.nom @@ -27,6 +27,18 @@ compile [assume %condition or barf %message] to (..) error(\(%message as lua expr), 0) end +test: + try (barf) and if it succeeds: barf "try failed." + %worked = (no) + try (barf) and if it barfs: %worked = (yes) + assume %worked or barf "try/catch failed" + %x = 1 + try: + %x = 2 + do (barf) then always: %x = 3 + ..and if it barfs: do nothing + + assume (%x == 3) or barf "do/then always failed" # Try/except compile [..] @@ -75,4 +87,4 @@ parse [try %action and if it barfs %msg %fallback] as (..) try %action and if it succeeds (do nothing) or if it barfs %msg %fallback parse [try %action and if it succeeds %success] as (..) - try %action and if it succeeds %success or if it barfs (do nothing)
\ No newline at end of file + try %action and if it succeeds %success or if it barfs (do nothing) |
