From b6aacb718140fce1c0d53265c1a63c5f1dfd0e4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20H=C3=B6rberg?= Date: Sat, 11 May 2024 22:11:24 +0200 Subject: [PATCH] Declaring an exchange with an invalid type is a precondition failure Not a invalid command that closes the whole connection. --- deps/rabbit/src/rabbit_exchange.erl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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