From 58a668a67081c1c3374605fcc9d98b13680454a3 Mon Sep 17 00:00:00 2001 From: Adam Kocoloski Date: Wed, 2 Jun 2010 12:17:48 -0400 Subject: throw an error in all_parts if DB does not exist --- src/partitions.erl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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. -- cgit v1.2.3