summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandru Scvortov <alexandru@rabbitmq.com>2010-08-06 10:57:27 +0100
committerAlexandru Scvortov <alexandru@rabbitmq.com>2010-08-06 10:57:27 +0100
commit3f1e65c73d12199931d9b88631b990d7df01d7dd (patch)
treef73e12717fd3dfcbbf67f4aef3c463ea0b5801cc
parentd117531c0355fe8622205c294d56b99a53d25445 (diff)
downloadrabbitmq-server-3f1e65c73d12199931d9b88631b990d7df01d7dd.tar.gz
more informative failure messages
-rw-r--r--src/rabbit_mnesia.erl27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/rabbit_mnesia.erl b/src/rabbit_mnesia.erl
index 84c376b5..5667bae9 100644
--- a/src/rabbit_mnesia.erl
+++ b/src/rabbit_mnesia.erl
@@ -233,18 +233,23 @@ ensure_mnesia_not_running() ->
end.
check_schema_integrity() ->
- try
- TabDefs = table_definitions(),
- case lists:all(fun(Tab) ->
- {_, TabDef} = proplists:lookup(Tab, TabDefs),
- {_, ExpAttrs} = proplists:lookup(attributes, TabDef),
- ExpAttrs == mnesia:table_info(Tab, attributes)
- end, table_names()) of
- true -> ok;
- false -> {error, database_tables_incompatible}
- end
+ try TabDefs = table_definitions(),
+ TAs = lists:map(fun(Tab) ->
+ {_, TabDef} = proplists:lookup(Tab, TabDefs),
+ {_, ExpAttrs} = proplists:lookup(attributes, TabDef),
+ Attrs = mnesia:table_info(Tab, attributes),
+ case ExpAttrs == Attrs of
+ true -> ok;
+ false -> {table_attributes_mismatch, Tab,
+ ExpAttrs, Attrs}
+ end
+ end, table_names()),
+ lists:filter(fun(X) -> X /= ok end, TAs)
+ of
+ [] -> ok;
+ Ps -> {error, Ps}
catch
- _:Reason ->
+ exit:Reason ->
{error, Reason}
end.