aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrahflow <drahflow@gmx.de>2014-03-02 00:23:48 +0100
committerDrahflow <drahflow@gmx.de>2014-03-02 00:23:48 +0100
commitb2150cc0d050522acae179a891c69bab01581061 (patch)
treeb0b51bfc87a8201dbc057150bcce9d8665835bc4
parent3e15935528f17cbf6c13c0af21992f1e05bdf443 (diff)
Error handling library
-rw-r--r--elymas/lib/err.ey34
1 files changed, 34 insertions, 0 deletions
diff --git a/elymas/lib/err.ey b/elymas/lib/err.ey
new file mode 100644
index 0000000..9c0f32d
--- /dev/null
+++ b/elymas/lib/err.ey
@@ -0,0 +1,34 @@
+<
+ "<weird entry into error handler>" ==origWhat
+
+ < > ==theHandler
+
+ {
+ theHandler sys .dyn .get not { <
+ { "An unhandled error has occured, terminating program: " origWhat cat die } "" deffst
+ > } rep
+ } =*currentHandler
+
+ { ==handler # ==what
+ { handler -101 .? not } { _ len 1 sub -01 str .prefix } loop # TODO: actually strip one .xxx part
+ handler -01 .
+ } /applyHandler deffd
+
+ # !!?, clones current coroutine state, useful in error handling, name follows intuitive understanding closely
+ { { } { -- !!? } !!' } "!!?"
+
+ { _ =origWhat # ==possibleActions
+ currentHandler applyHandler
+ } "???"
+
+ { < > -01 ??? } "??"
+ { { currentHandler applyHandler } currentHandler "" . theHandler sys .dyn .with } "??!"
+ { { origWhat currentHandler applyHandler } currentHandler "" . theHandler sys .dyn .with } "??!'"
+ { currentHandler < "" -11032 =* == >' theHandler sys .dyn .with } "?!"
+
+ { ==what =*onErrorStrategy ==main 0 ==i
+ { main { i onErrorStrategy =main i 1 add =i try } what ?! } _ =*try *
+ } "?!!"
+> -- 7 |deffd rep
+
+# vim: syn=elymas