Skip to content

Instantly share code, notes, and snippets.

@rnewson
Created October 31, 2014 12:54
Show Gist options
  • Select an option

  • Save rnewson/e051822d3cc41f8f428e to your computer and use it in GitHub Desktop.

Select an option

Save rnewson/e051822d3cc41f8f428e to your computer and use it in GitHub Desktop.
diff --git a/src/mem3_util.erl b/src/mem3_util.erl
index bb15e0e..785a27e 100644
--- a/src/mem3_util.erl
+++ b/src/mem3_util.erl
@@ -221,7 +221,12 @@ ensure_exists(DbName) ->
{ok, Db} ->
{ok, Db};
_ ->
- couch_server:create(DbName, Options)
+ case couch_server:create(DbName, Options) of
+ {ok, Db} ->
+ {ok, Db};
+ file_exists ->
+ ensure_exists(DbName)
+ end
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment