@@ -285,16 +285,29 @@ shutdown_node_and_wait_pid_to_stop(Node, Pid, Inform) ->
285285 " RabbitMQ node ~p running at PID ~s successfully shut down" ,
286286 [Node , Pid ]),
287287 Res ;
288- {error , Err } ->
289- {error , {error_during_shutdown , Err }};
290- _ ->
291- Res
288+ % NB: this is the return value for any errors raised by
289+ % an RPC call to rabbit:stop_and_halt. We return error_during_shutdown
290+ % so that rabbit_cli:main can differentiate this error from
291+ % other badrpc errors
292+ {badrpc , {'EXIT' , RpcErr }} ->
293+ {error , {error_during_shutdown , RpcErr }};
294+ % NB: rabbit_cli:main pretty-prints other badrpc errors using
295+ % rabbit_nodes:diagnostics, so don't modify the error here.
296+ Error -> Error
292297 end .
293298
294299action (shutdown , Node , [], _Opts , Inform ) ->
295300 case rpc :call (Node , os , getpid , []) of
296301 Pid when is_list (Pid ) ->
297302 shutdown_node_and_wait_pid_to_stop (Node , Pid , Inform );
303+ % NB: this is the rpc return value for any errors raised by
304+ % rpc:call. We return error_during_shutdown so that
305+ % rabbit_cli:main can differentiate this error from other badrpc
306+ % errors
307+ {badrpc , {'EXIT' , RpcErr }} ->
308+ {error , {error_during_shutdown , RpcErr }};
309+ % NB: rabbit_cli:main pretty-prints other badrpc errors using
310+ % rabbit_nodes:diagnostics, so don't modify the error here.
298311 Error -> Error
299312 end ;
300313
0 commit comments