Skip to content

Commit 38af545

Browse files
author
Simon MacMullen
committed
Merge bug 24392
2 parents 41b41f6 + 74dfa4d commit 38af545

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

src/rabbit_misc.erl

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -250,18 +250,23 @@ assert_args_equivalence(Orig, New, Name, Keys) ->
250250
ok.
251251

252252
assert_args_equivalence1(Orig, New, Name, Key) ->
253-
case {table_lookup(Orig, Key), table_lookup(New, Key)} of
253+
{Orig1, New1} = {table_lookup(Orig, Key), table_lookup(New, Key)},
254+
FailureFun = fun () ->
255+
protocol_error(precondition_failed, "inequivalent arg '~s'"
256+
"for ~s: received ~s but current is ~s",
257+
[Key, rs(Name), val(New1), val(Orig1)])
258+
end,
259+
case {Orig1, New1} of
254260
{Same, Same} ->
255261
ok;
256-
{{OrigType, OrigVal} = Orig1, {NewType, NewVal} = New1} ->
262+
{{OrigType, OrigVal}, {NewType, NewVal}} ->
257263
case type_class(OrigType) == type_class(NewType) andalso
258264
OrigVal == NewVal of
259265
true -> ok;
260-
false -> protocol_error(precondition_failed, "inequivalent arg"
261-
" '~s' for ~s: received ~s but current"
262-
" is ~s",
263-
[Key, rs(Name), val(New1), val(Orig1)])
264-
end
266+
false -> FailureFun()
267+
end;
268+
{_, _} ->
269+
FailureFun()
265270
end.
266271

267272
val(undefined) ->

0 commit comments

Comments
 (0)