summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTony Garnock-Jones <tonyg@lshift.net>2009-11-23 14:48:38 +0000
committerTony Garnock-Jones <tonyg@lshift.net>2009-11-23 14:48:38 +0000
commit75021f92951a14ccdc9e36e7b7ad1e026872ddc1 (patch)
tree1b60f38fb71bbbf1d6fb25bf33e36ae61a8bb851
parent941e298345a2f768815790b5df029147b7511749 (diff)
downloadrabbitmq-server-git-75021f92951a14ccdc9e36e7b7ad1e026872ddc1.tar.gz
Catch list_to_existing_atom error, throw command_invalid
-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),