aboutsummaryrefslogtreecommitdiff
path: root/examples/working-loaded/error.test
diff options
context:
space:
mode:
authorDrahflow <drahflow@gmx.de>2014-03-02 00:24:20 +0100
committerDrahflow <drahflow@gmx.de>2014-03-02 00:24:20 +0100
commite9f4e9e2992870920dafe0abc7418d8ea7f42a29 (patch)
treec6915481fba8e84b386d5718ae8ea7e11d5218ac /examples/working-loaded/error.test
parentb2150cc0d050522acae179a891c69bab01581061 (diff)
Now using the error library
Diffstat (limited to 'examples/working-loaded/error.test')
-rw-r--r--examples/working-loaded/error.test58
1 files changed, 4 insertions, 54 deletions
diff --git a/examples/working-loaded/error.test b/examples/working-loaded/error.test
index ae1b35a..bce6b69 100644
--- a/examples/working-loaded/error.test
+++ b/examples/working-loaded/error.test
@@ -1,57 +1,7 @@
-# !!?, clones current coroutine state, useful in error handling, name follows intuitive understanding closely
-{ { } { -- !!? } !!' } "!!?" deffd
-
-<
- "<weird entry into error handler>" ==origWhat
-
- <
- { "An unhandled error has occured, terminating program: " origWhat cat die } "" deffst
- > ==handler
-
- { _ =origWhat
- { handler -101 .? not } { _ len 1 sub -01 str .prefix } loop # TODO: actually strip one .xxx part
- < > handler -102 .
- } "??"
-
- { ==what _ ==actions keys
- < { actions -101 . -01 =* }' each >' handler "" . what .
- } "??!"
-
- { handler < "" -11032 =* == >' =handler * } "?!"
-
- { ==what =*onErrorStrategy ==main 0 ==i
- { main { i onErrorStrategy =main i 1 add =i try } what ?! } _ =*try *
- } "?!!"
-> -- 4 |deffd rep
-
-# verbose versions of above functions
-# { _ =origWhat ==what
-# { handler what .? not } {
-# what len 1 sub what str .prefix =what # TODO: actually strip one .xxx part
-# } loop
-# < > handler what .
-# } "??"
-#
-# { ==what ==actions
-# ==alternatives
-# <
-# actions keys { actions -101 . -01 =* }' each
-# alternatives
-# >' handler "" . what .
-# } "??!"
-#
-# { ==what ==onError =*main
-# handler ==oldHandler
-# < onError what =* oldHandler "" == oldHandler >' =handler
-# main
-# } "?!"
-
-### library ^^^^^^^^^^^^^^^
-
{ ==file
"trying to frobnicate file" dump file dump
file "conf" eq
- # 1 or
+ 1 or
{ ??io.read } rep # oops, this failed
"continuing frobnication..." dump
} /frobnicateFile deffst
@@ -62,9 +12,9 @@
{
file frobnicateFile
} {
- <
- { "conf.bak" =file restartFrobnication 0 ! } ==useBackup
- { "Enter config by hand" dump doItManually 0 ! } ==manualEntry
+ -- <
+ { "conf.bak" =file restartFrobnication 0 ! } =*useBackup
+ { "Enter config by hand" dump doItManually 0 ! } =*manualEntry
> ??!io
} ?!io
} {