]> gitweb.factorcode.org Git - factor.git/blobdiff - extra/couchdb/couchdb.factor
basis,extra: refactorings to use the ignore-error and ignore-error/f words
[factor.git] / extra / couchdb / couchdb.factor
index 0de1cb95b8bbf6de0027ab0bebf5c42933d80a36..15db1920e1d3934557a7f3a549b6110d3fa24bf9 100644 (file)
@@ -1,9 +1,9 @@
 ! Copyright (C) 2008, 2009 Alex Chapman
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors arrays assocs continuations debugger hashtables http
+USING: accessors assocs continuations debugger fry hashtables http
 http.client io io.encodings.string io.encodings.utf8 json.reader
 json.writer kernel locals make math math.parser namespaces sequences
-strings urls urls.encoding vectors ;
+strings urls.encoding vectors ;
 IN: couchdb
 
 ! NOTE: This code only works with the latest couchdb (0.9.*), because old
@@ -111,9 +111,7 @@ C: <db> db
     f swap db-url couch-put response-ok* ;
 
 : ensure-db ( db -- )
-    [ create-db ] [
-        dup file-exists-error? [ 2drop ] [ rethrow ] if
-    ] recover ;
+    '[ _ create-db ] [ file-exists-error? ] ignore-error ;
 
 : delete-db ( db -- )
     db-url couch-delete drop ;