diff --git a/deps/rabbit/src/rabbit_exchange.erl b/deps/rabbit/src/rabbit_exchange.erl index 3ecb87ba7ea..22fbaafb69c 100644 --- a/deps/rabbit/src/rabbit_exchange.erl +++ b/deps/rabbit/src/rabbit_exchange.erl @@ -140,11 +140,11 @@ check_type(TypeBin) -> case rabbit_registry:binary_to_type(rabbit_data_coercion:to_binary(TypeBin)) of {error, not_found} -> rabbit_misc:protocol_error( - command_invalid, "unknown exchange type '~ts'", [TypeBin]); + precondition_failed, "unknown exchange type '~ts'", [TypeBin]); T -> case rabbit_registry:lookup_module(exchange, T) of {error, not_found} -> rabbit_misc:protocol_error( - command_invalid, + precondition_failed, "invalid exchange type '~ts'", [T]); {ok, _Module} -> T end