refactor: use new rabbit_misc:format/2
This commit is contained in:
parent
0b1222e16d
commit
d4dd7b7b96
|
|
@ -958,7 +958,7 @@ ok(Command, Headers, BodyFragments, State) ->
|
|||
|
||||
amqp_death(ReplyCode, Explanation, State) ->
|
||||
ErrorName = ?PROTOCOL:amqp_exception(ReplyCode),
|
||||
ErrorDesc = format_detail("~s~n", [Explanation]),
|
||||
ErrorDesc = rabbit_misc:format("~s~n", [Explanation]),
|
||||
log_error(ErrorName, ErrorDesc, none),
|
||||
{stop, normal, send_error(atom_to_list(ErrorName), ErrorDesc, State)}.
|
||||
|
||||
|
|
@ -973,7 +973,7 @@ priv_error(Message, Detail, ServerPrivateDetail, State) ->
|
|||
{error, Message, Detail, State}.
|
||||
|
||||
priv_error(Message, Format, Args, ServerPrivateDetail, State) ->
|
||||
priv_error(Message, format_detail(Format, Args), ServerPrivateDetail,
|
||||
priv_error(Message, rabbit_misc:format(Format, Args), ServerPrivateDetail,
|
||||
State).
|
||||
|
||||
log_error(Message, Detail, ServerPrivateDetail) ->
|
||||
|
|
@ -983,8 +983,6 @@ log_error(Message, Detail, ServerPrivateDetail) ->
|
|||
"Server private detail: ~p~n",
|
||||
[Message, Detail, ServerPrivateDetail]).
|
||||
|
||||
format_detail(Format, Args) -> lists:flatten(io_lib:format(Format, Args)).
|
||||
|
||||
%%----------------------------------------------------------------------------
|
||||
%% Frame sending utilities
|
||||
%%----------------------------------------------------------------------------
|
||||
|
|
@ -1008,7 +1006,7 @@ send_error(Message, Detail, State) ->
|
|||
Detail, State).
|
||||
|
||||
send_error(Message, Format, Args, State) ->
|
||||
send_error(Message, format_detail(Format, Args), State).
|
||||
send_error(Message, rabbit_misc:format(Format, Args), State).
|
||||
|
||||
%%----------------------------------------------------------------------------
|
||||
%% Skeleton gen_server2 callbacks
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ headers_escaping_roundtrip_test() ->
|
|||
{ok, Val} = rabbit_stomp_frame:header(Frame, "header"),
|
||||
?assertEqual(":\n\\", Val),
|
||||
Serialized = lists:flatten(rabbit_stomp_frame:serialize(Frame)),
|
||||
?assertEqual(Content, lists:flatten(io_lib:format("~s", [Serialized]))).
|
||||
?assertEqual(Content, rabbit_misc:format("~s", [Serialized])).
|
||||
|
||||
parse(Content) ->
|
||||
parse(Content, rabbit_stomp_frame:initial_state()).
|
||||
|
|
|
|||
Loading…
Reference in New Issue