json_to_term/2 now returns {incomplete, More} when input ends prematurely rather than an error tuple when called with the option {stream, true}
This commit is contained in:
parent
8ed4b1a405
commit
c973abd1b2
2 changed files with 5 additions and 1 deletions
0
doc/_layouts/default.html
Normal file
0
doc/_layouts/default.html
Normal file
|
@ -128,7 +128,11 @@ collect({event, Event, Next}, [Key, Current|Rest], Opts) ->
|
||||||
collect({incomplete, More}, [[]], Opts) ->
|
collect({incomplete, More}, [[]], Opts) ->
|
||||||
case More(end_stream) of
|
case More(end_stream) of
|
||||||
{event, Event, _Next} -> event(Event, Opts)
|
{event, Event, _Next} -> event(Event, Opts)
|
||||||
; _ -> erlang:error(badarg)
|
; _ ->
|
||||||
|
case proplists:get_value(stream, Opts, false) of
|
||||||
|
true -> {incomplete, More}
|
||||||
|
; false -> erlang:error(badarg)
|
||||||
|
end
|
||||||
end;
|
end;
|
||||||
%% any other event is an error
|
%% any other event is an error
|
||||||
collect(_, _, _) -> erlang:error(badarg).
|
collect(_, _, _) -> erlang:error(badarg).
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue