mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 12:20:24 +00:00
Exit with required error when checking a constrait and key does not exist.
This commit is contained in:
parent
8795233c57
commit
91b28d6109
1 changed files with 6 additions and 1 deletions
|
@ -991,7 +991,12 @@ filter([], Map, Errors) ->
|
|||
_ -> {error, Errors}
|
||||
end;
|
||||
filter([{Key, Constraints}|Tail], Map, Errors) ->
|
||||
filter_constraints(Tail, Map, Errors, Key, maps:get(Key, Map), Constraints);
|
||||
case maps:find(Key, Map) of
|
||||
{ok, Value} ->
|
||||
filter_constraints(Tail, Map, Errors, Key, Value, Constraints);
|
||||
error ->
|
||||
filter(Tail, Map, Errors#{Key => required})
|
||||
end;
|
||||
filter([{Key, Constraints, Default}|Tail], Map, Errors) ->
|
||||
case maps:find(Key, Map) of
|
||||
{ok, Value} ->
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue