decoder now catches function clause errors and converts them to {error, badjson} tuples
This commit is contained in:
parent
c29f60ea34
commit
ac518dfe4a
1 changed files with 1 additions and 1 deletions
|
@ -101,7 +101,7 @@ decoder({{Mod, Fun}, State}, OptsList) when is_list(OptsList), is_atom(Mod), is_
|
||||||
Opts = parse_opts(OptsList),
|
Opts = parse_opts(OptsList),
|
||||||
decoder({fun(E, S) -> Mod:Fun(E, S) end, State}, Opts);
|
decoder({fun(E, S) -> Mod:Fun(E, S) end, State}, Opts);
|
||||||
decoder(Callbacks, Opts) ->
|
decoder(Callbacks, Opts) ->
|
||||||
fun(Stream) -> start(Stream, [], Callbacks, Opts) end.
|
fun(Stream) -> try start(Stream, [], Callbacks, Opts) catch error:function_clause -> {error, badjson} end end.
|
||||||
|
|
||||||
|
|
||||||
parse_opts(Opts) ->
|
parse_opts(Opts) ->
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue