summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/rabbit_exchange.erl8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/rabbit_exchange.erl b/src/rabbit_exchange.erl
index 9e0fca78ae..9af7a7a008 100644
--- a/src/rabbit_exchange.erl
+++ b/src/rabbit_exchange.erl
@@ -135,7 +135,13 @@ declare(ExchangeName, Type, Durable, AutoDelete, Args) ->
end).
typename_to_plugin_module(T) when is_binary(T) ->
- list_to_existing_atom("rabbit_exchange_type_" ++ binary_to_list(T)).
+ case catch list_to_existing_atom("rabbit_exchange_type_" ++ binary_to_list(T)) of
+ {'EXIT', {badarg, _}} ->
+ rabbit_misc:protocol_error(
+ command_invalid, "invalid exchange type '~s'", [T]);
+ Module ->
+ Module
+ end.
plugin_module_to_typename(M) when is_atom(M) ->
"rabbit_exchange_type_" ++ S = atom_to_list(M),