]> gitweb.factorcode.org Git - factor.git/blobdiff - core/continuations/continuations.factor
continuations: new words for ignoring masked errors
[factor.git] / core / continuations / continuations.factor
index a3402e7a164411f853e8e9e557a20348eca7fd39..063038a1d791a377121213fa2a808eb94a4c295e 100644 (file)
@@ -151,6 +151,14 @@ callback-error-hook [ [ die rethrow ] ] initialize
 : ignore-errors ( quot -- )
     [ drop ] recover ; inline
 
+: ignore-error ( quot check: ( error -- ? ) -- )
+    [ dup ] prepose [ [ drop ] [ rethrow ] if ] compose
+    recover ; inline
+
+: ignore-error/f ( quot check: ( error -- ? ) -- )
+    [ dup ] prepose [ [ drop f ] [ rethrow ] if ] compose
+    recover ; inline
+
 : cleanup ( try cleanup-always cleanup-error -- )
     [ compose [ dip rethrow ] curry recover ] [ drop ] 2bi call ; inline