Skip to content

Commit

Permalink
Prevent formatter crash in mgmt_util
Browse files Browse the repository at this point in the history
`rabbit_mgmt_util:direct_request/6` is always called with an
`ErrorMsg` which expects one format argument as a string. Convert the
arbitrary reason term into a string to avoid a crash like the below:

```
warning: FORMATTER CRASH: {"Delete exchange error: ~ts",[{'EXIT',{{badmatch,{error,...
```
  • Loading branch information
gomoripeti committed Dec 19, 2023
1 parent 5eb4eef commit 0a144e7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion deps/rabbitmq_management/src/rabbit_mgmt_util.erl
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,8 @@ direct_request(MethodName, Transformers, Extra, ErrorMsg, ReqData,
rabbit_log:warning(ErrorMsg, [Explanation]),
bad_request(list_to_binary(Explanation), ReqData1, Context);
{badrpc, Reason} ->
rabbit_log:warning(ErrorMsg, [Reason]),
Msg = io_lib:format("~tp", [Reason]),
rabbit_log:warning(ErrorMsg, [Msg]),
bad_request(
list_to_binary(
io_lib:format("Request to node ~ts failed with ~tp",
Expand Down

0 comments on commit 0a144e7

Please sign in to comment.