diff options
author | Emile Joubert <emile@rabbitmq.com> | 2011-06-03 15:23:53 +0100 |
---|---|---|
committer | Emile Joubert <emile@rabbitmq.com> | 2011-06-03 15:23:53 +0100 |
commit | 0a4c43d10e88004e3912a91ee7be8efa8e50edc7 (patch) | |
tree | 50eb82ea5b9a37bcd05382f4f828d7d9cd74511d /src | |
parent | 99761af89a8f3a2cf9b175b750f89e6bc2173343 (diff) | |
download | rabbitmq-server-0a4c43d10e88004e3912a91ee7be8efa8e50edc7.tar.gz |
More consitent exception handlingbug24128
Diffstat (limited to 'src')
-rw-r--r-- | src/rabbit_control.erl | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/rabbit_control.erl b/src/rabbit_control.erl index 5f8d9f97..be1c08d8 100644 --- a/src/rabbit_control.erl +++ b/src/rabbit_control.erl @@ -343,9 +343,9 @@ action(list_permissions, Node, [], Opts, Inform) -> action(report, Node, _Args, _Opts, Inform) -> io:format("Reporting server status on ~p~n~n", [erlang:universaltime()]), [begin ok = action(Action, N, [], [], Inform), io:nl() end || - N <- rpc_call(Node, rabbit_mnesia, running_clustered_nodes, []), + N <- unsafe_rpc(Node, rabbit_mnesia, running_clustered_nodes, []), Action <- [status, cluster_status, environment]], - VHosts = rpc_call(Node, rabbit_vhost, list, []), + VHosts = unsafe_rpc(Node, rabbit_vhost, list, []), [print_report(Node, Q) || Q <- ?GLOBAL_QUERIES], [print_report(Node, Q, [V]) || Q <- ?VHOST_QUERIES, V <- VHosts], io:format("End of server status report~n"), @@ -428,11 +428,17 @@ display_list(Other) -> Other. display_call_result(Node, MFA) -> case call(Node, MFA) of - {badrpc, _} = Res -> Res; + {badrpc, _} = Res -> throw(Res); Res -> io:format("~p~n", [Res]), ok end. +unsafe_rpc(Node, Mod, Fun, Args) -> + case rpc_call(Node, Mod, Fun, Args) of + {badrpc, _} = Res -> throw(Res); + Normal -> Normal + end. + call(Node, {Mod, Fun, Args}) -> rpc_call(Node, Mod, Fun, lists:map(fun list_to_binary/1, Args)). |