summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2015-02-26 14:48:28 +0000
committerSimon MacMullen <simon@rabbitmq.com>2015-02-26 14:48:28 +0000
commitcfc289b72cfc2619b4694fe13fa100c64d328018 (patch)
tree41b0cc4b2a49520cd58bcee5f2fca547f4f36a87
parentb1cfedc71209a9fe91016b90107ac2e3639eab43 (diff)
downloadrabbitmq-server-git-cfc289b72cfc2619b4694fe13fa100c64d328018.tar.gz
Detangle boot error handling, step 1
We want to clean up basic_boot_error/3, but these call sites make it harder. Really, trying to produce nicely formatted errors here is a waste of time, these errors can only be caused when adding boot steps. Normal users should never see them. So don't complicate things by handling them specially.
-rw-r--r--src/rabbit.erl24
1 files changed, 4 insertions, 20 deletions
diff --git a/src/rabbit.erl b/src/rabbit.erl
index 3bfd442898..7e35224669 100644
--- a/src/rabbit.erl
+++ b/src/rabbit.erl
@@ -580,29 +580,13 @@ sort_boot_steps(UnsortedSteps) ->
{_App, StepName, Attributes} <- SortedSteps,
{mfa, {M,F,A}} <- Attributes,
not erlang:function_exported(M, F, length(A))] of
- [] -> SortedSteps;
- MissingFunctions -> basic_boot_error(
- {missing_functions, MissingFunctions},
- "Boot step functions not exported: ~p~n",
- [MissingFunctions])
+ [] -> SortedSteps;
+ MissingFns -> exit({boot_functions_not_exported, MissingFns})
end;
{error, {vertex, duplicate, StepName}} ->
- basic_boot_error({duplicate_boot_step, StepName},
- "Duplicate boot step name: ~w~n", [StepName]);
+ exit({duplicate_boot_step, StepName});
{error, {edge, Reason, From, To}} ->
- basic_boot_error(
- {invalid_boot_step_dependency, From, To},
- "Could not add boot step dependency of ~w on ~w:~n~s",
- [To, From,
- case Reason of
- {bad_vertex, V} ->
- io_lib:format("Boot step not registered: ~w~n", [V]);
- {bad_edge, [First | Rest]} ->
- [io_lib:format("Cyclic dependency: ~w", [First]),
- [io_lib:format(" depends on ~w", [Next]) ||
- Next <- Rest],
- io_lib:format(" depends on ~w~n", [First])]
- end])
+ exit({invalid_boot_step_dependency, From, To, Reason})
end.
-ifdef(use_specs).