@@ -351,14 +351,10 @@ start_it(StartFun) ->
351351 false -> StartFun ()
352352 end
353353 catch
354- throw :{could_not_start , rabbit ,
355- boot_failure_already_logged } ->
356- throw (boot_failure_already_logged ),
357- ok ;
358354 throw :{could_not_start , _App , _Reason } = Err ->
359- boot_error (Err , wrapper , not_available );
355+ boot_error (Err , not_available );
360356 _ :Reason ->
361- boot_error (Reason , wrapper , erlang :get_stacktrace ())
357+ boot_error (Reason , erlang :get_stacktrace ())
362358 after
363359 unlink (Marker ),
364360 Marker ! stop ,
@@ -415,7 +411,7 @@ handle_app_error(Term) ->
415411 end .
416412
417413run_cleanup_steps (Apps ) ->
418- [run_step (Name , Attrs , cleanup ) || { _ , Name , Attrs } <- find_steps (Apps )],
414+ [run_step (Attrs , cleanup ) || Attrs <- find_steps (Apps )],
419415 ok .
420416
421417await_startup () ->
@@ -543,27 +539,22 @@ run_boot_steps() ->
543539 run_boot_steps ([App || {App , _ , _ } <- application :loaded_applications ()]).
544540
545541run_boot_steps (Apps ) ->
546- [ok = run_step (Step , Attrs , mfa ) || { _ , Step , Attrs } <- find_steps (Apps )],
542+ [ok = run_step (Attrs , mfa ) || Attrs <- find_steps (Apps )],
547543 ok .
548544
549545find_steps (Apps ) ->
550546 All = sort_boot_steps (rabbit_misc :all_module_attributes (rabbit_boot_step )),
551- [Step || {App , _ , _ } = Step <- All , lists :member (App , Apps )].
547+ [Attrs || {App , _ , Attrs } <- All , lists :member (App , Apps )].
552548
553- run_step (StepName , Attributes , AttributeName ) ->
549+ run_step (Attributes , AttributeName ) ->
554550 case [MFA || {Key , MFA } <- Attributes ,
555551 Key =:= AttributeName ] of
556552 [] ->
557553 ok ;
558554 MFAs ->
559- [try
560- apply (M ,F ,A )
561- of
555+ [case apply (M ,F ,A ) of
562556 ok -> ok ;
563- {error , Reason } -> boot_error (Reason , StepName , not_available )
564- catch
565- _ :Reason -> boot_error (Reason , StepName ,
566- erlang :get_stacktrace ())
557+ {error , Reason } -> exit ({error , Reason })
567558 end || {M ,F ,A } <- MFAs ],
568559 ok
569560 end .
@@ -611,10 +602,10 @@ sort_boot_steps(UnsortedSteps) ->
611602 end .
612603
613604-ifdef (use_specs ).
614- -spec (boot_error / 3 :: (term (), atom (), not_available | [tuple ()])
615- -> no_return ()).
605+ -spec (boot_error / 2 :: (term (), not_available | [tuple ()]) -> no_return ()).
616606-endif .
617- boot_error ({error , {timeout_waiting_for_tables , _ }}, _Step , _Stacktrace ) ->
607+ boot_error ({could_not_start , rabbit , {{timeout_waiting_for_tables , _ }, _ }},
608+ _Stacktrace ) ->
618609 AllNodes = rabbit_mnesia :cluster_nodes (all ),
619610 {Err , Nodes } =
620611 case AllNodes -- [node ()] of
@@ -626,33 +617,29 @@ boot_error({error, {timeout_waiting_for_tables, _}}, _Step, _Stacktrace) ->
626617 Ns }
627618 end ,
628619 log_boot_error_and_exit (
620+ timeout_waiting_for_tables ,
629621 Err ++ rabbit_nodes :diagnostics (Nodes ) ++ " ~n~n " , []);
630- boot_error (Reason , Step , Stacktrace ) ->
631- Fmt0 = case Step of
632- wrapper -> " " ;
633- _ -> rabbit_misc :format (" Boot step:~n ~p~n~n " , [Step ])
634- end ,
635- Fmt = Fmt0 ++
636- " Error description:~n ~p~n~n "
622+ boot_error (Reason , Stacktrace ) ->
623+ Fmt = " Error description:~n ~p~n~n "
637624 " Log files (may contain more information):~n ~s~n ~s~n~n " ,
638625 Args = [Reason , log_location (kernel ), log_location (sasl )],
639- boot_error1 ( Fmt , Args , Stacktrace ).
626+ boot_error ( Reason , Fmt , Args , Stacktrace ).
640627
641628-ifdef (use_specs ).
642- -spec (boot_error1 / 3 :: (string (), [any ()], not_available | [tuple ()])
629+ -spec (boot_error / 4 :: (term (), string (), [any ()], not_available | [tuple ()])
643630 -> no_return ()).
644631-endif .
645- boot_error1 ( Fmt , Args , not_available ) ->
646- log_boot_error_and_exit (Fmt , Args );
647- boot_error1 ( Fmt , Args , Stacktrace ) ->
648- log_boot_error_and_exit (Fmt ++ " Stack trace:~n ~p~n~n " ,
632+ boot_error ( Reason , Fmt , Args , not_available ) ->
633+ log_boot_error_and_exit (Reason , Fmt , Args );
634+ boot_error ( Reason , Fmt , Args , Stacktrace ) ->
635+ log_boot_error_and_exit (Reason , Fmt ++ " Stack trace:~n ~p~n~n " ,
649636 Args ++ [Stacktrace ]).
650637
651- log_boot_error_and_exit (Format , Args ) ->
638+ log_boot_error_and_exit (Reason , Format , Args ) ->
652639 io :format (" ~n~n BOOT FAILED~n ===========~n~n " ++ Format , Args ),
653640 rabbit_log :info (Format , Args ),
654641 timer :sleep (1000 ),
655- exit (boot_failure_already_logged ).
642+ exit (Reason ).
656643
657644% %---------------------------------------------------------------------------
658645% % boot step functions
0 commit comments