Skip to content

Commit 98616a0

Browse files
committed
rabbit_amqp_management: Use HTTP code 503 for timeout errors
`rabbit_amqp_management` returns HTTP status codes to the client. 503 means that a service is unavailable (which Khepri is while it is in a minority) so it's a more appropriate code than the generic 500 internal server error.
1 parent 52a0d70 commit 98616a0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

deps/rabbit/src/rabbit_amqp_management.erl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ handle_http_req(<<"PUT">>,
217217
DeclaredX;
218218
{error, timeout} ->
219219
throw(
220-
<<"500">>,
220+
<<"503">>,
221221
"Could not create exchange '~ts' in vhost '~ts' "
222222
"because the operation timed out",
223223
[XName, Vhost])
@@ -299,7 +299,7 @@ handle_http_req(<<"DELETE">>,
299299
{<<"204">>, null, {PermCache, TopicPermCache}};
300300
{error, timeout} ->
301301
throw(
302-
<<"500">>,
302+
<<"503">>,
303303
"failed to delete exchange '~ts' due to a timeout",
304304
[XNameBin])
305305
end;

0 commit comments

Comments
 (0)