A-M baby
This commit is contained in:
parent
764da6cbbb
commit
db842d013d
19005 changed files with 197040 additions and 7 deletions
12
Task/Exceptions/Factor/exceptions-3.factor
Normal file
12
Task/Exceptions/Factor/exceptions-3.factor
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
! Preferred exception handling
|
||||
: try-foo
|
||||
[ foo ] [ foo-failed ] recover ;
|
||||
|
||||
: try-bar
|
||||
[ bar ] [ bar-errored ] [ bar-always ] cleanup ;
|
||||
|
||||
! Used rarely
|
||||
[ "Fail" throw ] try ! throws a "Fail"
|
||||
[ "Fail" throw ] catch ! returns "Fail"
|
||||
[ "Hi" print ] catch ! returns f (looks the same as throwing f; don't throw f)
|
||||
[ f throw ] catch ! returns f, bad! use recover or cleanup instead
|
||||
Loading…
Add table
Add a link
Reference in a new issue