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
commit588f04825a17950f7645a2a79b30e6277d5f4368 (patch)
tree1b60f38fb71bbbf1d6fb25bf33e36ae61a8bb851
parentd30697d29cb65871efabb71a2f9767e28fccb76a (diff)
downloadrabbitmq-server-588f04825a17950f7645a2a79b30e6277d5f4368.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 9e0fca78..9af7a7a0 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),