return {incomplete, ...} rather than error on incomplete input to json_to_term
This commit is contained in:
parent
588c836547
commit
6357eb74c1
1 changed files with 2 additions and 2 deletions
|
@ -159,11 +159,11 @@ collect([{key, _} = PreKey|Next], Acc, Opts) ->
|
||||||
Key = event(PreKey, Opts),
|
Key = event(PreKey, Opts),
|
||||||
collect(Next, [Key] ++ Acc, Opts);
|
collect(Next, [Key] ++ Acc, Opts);
|
||||||
%% if our returned event is {jsx, incomplete, ...} try to force end and return
|
%% if our returned event is {jsx, incomplete, ...} try to force end and return
|
||||||
%% the Event if one is returned
|
%% the Event if one is returned, else just return {incomplete, More/1}
|
||||||
collect({jsx, incomplete, More}, _Acc, Opts) ->
|
collect({jsx, incomplete, More}, _Acc, Opts) ->
|
||||||
case More(end_stream) of
|
case More(end_stream) of
|
||||||
{jsx, [Event, end_json], _Next} -> event(Event, Opts)
|
{jsx, [Event, end_json], _Next} -> event(Event, Opts)
|
||||||
; _ -> erlang:error(badarg)
|
; _ -> {incomplete, More}
|
||||||
end;
|
end;
|
||||||
%% check acc to see if we're inside an object or an array. because inside an
|
%% check acc to see if we're inside an object or an array. because inside an
|
||||||
%% object context the events that fall this far are always preceded by a key
|
%% object context the events that fall this far are always preceded by a key
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue