Skip to content

Commit a273ab0

Browse files
authored
Merge pull request #1586 from rabbitmq/rabbitmq-management-565
One more place where a map definition must be converted to proplist before validation
2 parents 8aea4b8 + 1788899 commit a273ab0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/rabbit_policy.erl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,9 @@ validation(Name, Terms) ->
468468

469469
validation(_Name, [], _Validator) ->
470470
{error, "no policy provided", []};
471+
validation(Name, Terms0, Validator) when is_map(Terms0) ->
472+
Terms = maps:to_list(Terms0),
473+
validation(Name, Terms, Validator);
471474
validation(_Name, Terms, Validator) when is_list(Terms) ->
472475
{Keys, Modules} = lists:unzip(
473476
rabbit_registry:lookup_all(Validator)),
@@ -481,8 +484,9 @@ validation(_Name, Terms, Validator) when is_list(Terms) ->
481484
end;
482485
false -> {error, "definition must be a dictionary: ~p", [Terms]}
483486
end;
484-
validation(_Name, Term, _Validator) ->
485-
{error, "parse error while reading policy: ~p", [Term]}.
487+
validation(Name, Term, Validator) ->
488+
{error, "parse error while reading policy ~s: ~p. Validator: ~p.",
489+
[Name, Term, Validator]}.
486490

487491
validation0(Validators, Terms) ->
488492
case lists:foldl(

0 commit comments

Comments
 (0)