]> gitweb.factorcode.org Git - factor.git/commitdiff
Add ignore-errors to core
authorSlava Pestov <slava@factorcode.org>
Tue, 26 Feb 2008 20:58:02 +0000 (14:58 -0600)
committerSlava Pestov <slava@factorcode.org>
Tue, 26 Feb 2008 20:58:02 +0000 (14:58 -0600)
core/continuations/continuations-docs.factor
core/continuations/continuations.factor
extra/tools/test/test.factor
extra/vocabs/monitor/monitor.factor

index a1e2525c14130c09051d41a1574063175b9599a3..5fc86e25d492c1cb1ffc481c59b78be714fdacaf 100755 (executable)
@@ -23,9 +23,10 @@ $nl
 "Two words raise an error in the innermost error handler for the current dynamic extent:"
 { $subsection throw }
 { $subsection rethrow }
-"Two words for establishing an error handler:"
+"Words for establishing an error handler:"
 { $subsection cleanup }
 { $subsection recover }
+{ $subsection ignore-errors }
 "Unhandled errors are reported in the listener and can be debugged using various tools. See " { $link "debugger" } "."
 { $subsection "errors-restartable" }
 { $subsection "errors-post-mortem" } ;
@@ -148,6 +149,10 @@ HELP: recover
 { $values { "try" quotation } { "recovery" "a quotation with stack effect " { $snippet "( error -- )" } } }
 { $description "Calls the " { $snippet "try" } " quotation. If an exception is thrown in the dynamic extent of the " { $snippet "try" } " quotation, restores the data stack and calls the " { $snippet "recovery" } " quotation to handle the error." } ;
 
+HELP: ignore-errors
+{ $values { "try" quotation } }
+{ $description "Calls the quotation. If an exception is thrown in the dynamic extent of the quotation, restores the data stack and returns." } ;
+
 HELP: rethrow
 { $values { "error" object } }
 { $description "Throws an error without saving the current continuation in the " { $link error-continuation } " global variable. This is done so that inspecting the error stacks sheds light on the original cause of the exception, rather than the point where it was rethrown." }
index a0aa59332ea2a85ee3ef21357bd7118a1fdd9aa2..d68b5b2433cae43e28a03c96d935d1b375628bd6 100755 (executable)
@@ -120,6 +120,9 @@ SYMBOL: thread-error-hook
 : recover ( try recovery -- )
     >r [ swap >c call c> drop ] curry r> ifcc ; inline
 
+: ignore-errors ( quot -- )
+    [ drop ] recover ; inline
+
 : cleanup ( try cleanup-always cleanup-error -- )
     over >r compose [ dip rethrow ] curry
     recover r> call ; inline
index 69093f18a62ed57ad5bbb7b81759b81579bd6c67..0ab68f502ea44d6a9536ce80270f1a684fb02c8c 100755 (executable)
@@ -48,9 +48,6 @@ SYMBOL: this-test
 : must-fail ( quot -- )
     [ drop t ] must-fail-with ;
 
-: ignore-errors ( quot -- )
-    [ drop ] recover ; inline
-
 : (run-test) ( vocab -- )
     dup vocab-source-loaded? [
         vocab-tests
index d3e4a4489679a9ce0535fb6ac17608ea7dd4b3f9..32a104687efe6304bd60ec770556d0a502caacaa 100755 (executable)
@@ -17,6 +17,6 @@ SYMBOL: vocab-monitor
     [\r
         "" resource-path t <monitor> vocab-monitor set-global\r
         [ monitor-thread t ] "Vocabulary monitor" spawn-server drop\r
-    ] [ drop ] recover ;\r
+    ] ignore-errors ;\r
 \r
 [ start-monitor-thread ] "vocabs.monitor" add-init-hook\r