summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdam Kocoloski <adam@cloudant.com>2010-06-02 12:17:48 -0400
committerAdam Kocoloski <adam@cloudant.com>2010-08-12 00:58:46 -0400
commit58a668a67081c1c3374605fcc9d98b13680454a3 (patch)
tree9fd9ce81b7790abfca8dafd1e79901d8fd3e7e54 /src
parent2a9cc195ec53a5d15d2240d09dae59c007e6471f (diff)
throw an error in all_parts if DB does not exist
Diffstat (limited to 'src')
-rw-r--r--src/partitions.erl7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/partitions.erl b/src/partitions.erl
index ade8efe4..d64d405a 100644
--- a/src/partitions.erl
+++ b/src/partitions.erl
@@ -62,7 +62,12 @@ for_key(DbName, Key) ->
end.
all_parts(DbName) ->
- ets:lookup(partitions, DbName).
+ case ets:lookup(partitions, DbName) of
+ [] ->
+ erlang:error(database_does_not_exist);
+ Else ->
+ Else
+ end.
% %% @doc for the given key, return a list of {Node,Part} tuples. Nodes are both
% %% primary and replication partner nodes, and should number N.