mask a function_clause' error in encoder with a
badarg' error for api unity
This commit is contained in:
parent
95b1821a42
commit
522f72b2ce
2 changed files with 19 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
v2.7.2
|
||||||
|
|
||||||
|
* fix an issue where tuples were assumed to be jsx ast and not checked
|
||||||
|
* mask a `function_clause` error in encoder with a `badarg` error for api unity
|
||||||
|
|
||||||
v2.7.1
|
v2.7.1
|
||||||
|
|
||||||
* support for milliseconds in datetimes
|
* support for milliseconds in datetimes
|
||||||
|
|
|
@ -67,7 +67,8 @@ encode_(Else, _EntryPoint) -> [Else].
|
||||||
|
|
||||||
unzip([{K, V}|Rest], EntryPoint) when is_integer(K); is_binary(K); is_atom(K) ->
|
unzip([{K, V}|Rest], EntryPoint) when is_integer(K); is_binary(K); is_atom(K) ->
|
||||||
[K] ++ EntryPoint:encode(V, EntryPoint) ++ unzip(Rest, EntryPoint);
|
[K] ++ EntryPoint:encode(V, EntryPoint) ++ unzip(Rest, EntryPoint);
|
||||||
unzip([], _) -> [end_object].
|
unzip([], _) -> [end_object];
|
||||||
|
unzip(_, _) -> erlang:error(badarg).
|
||||||
|
|
||||||
|
|
||||||
unhitch([V|Rest], EntryPoint) ->
|
unhitch([V|Rest], EntryPoint) ->
|
||||||
|
@ -111,4 +112,16 @@ custom_error_handler_test_() ->
|
||||||
)}
|
)}
|
||||||
].
|
].
|
||||||
|
|
||||||
|
improper_lists_test_() ->
|
||||||
|
[
|
||||||
|
{"improper proplist", ?_assertError(
|
||||||
|
badarg,
|
||||||
|
encode([{<<"key">>, <<"value">>}, false])
|
||||||
|
)},
|
||||||
|
{"improper list", ?_assertError(
|
||||||
|
badarg,
|
||||||
|
encode([{literal, true}, false, null])
|
||||||
|
)}
|
||||||
|
].
|
||||||
|
|
||||||
-endif.
|
-endif.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue