Merge pull request #2 from pivotree/master
Switch top-level API to use erlang:error/2, to make errors reproducible from one stacktrace. Thanks to amtal.
This commit is contained in:
commit
d6dafcf47c
1 changed files with 4 additions and 4 deletions
|
@ -76,7 +76,7 @@ decoder(OptsList) ->
|
||||||
json_to_term(JSON) ->
|
json_to_term(JSON) ->
|
||||||
try json_to_term(JSON, [])
|
try json_to_term(JSON, [])
|
||||||
%% rethrow exception so internals aren't confusingly exposed to users
|
%% rethrow exception so internals aren't confusingly exposed to users
|
||||||
catch error:badarg -> erlang:error(badarg)
|
catch error:badarg -> erlang:error(badarg,[JSON])
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ json_to_term(JSON, Opts) ->
|
||||||
term_to_json(JSON) ->
|
term_to_json(JSON) ->
|
||||||
try term_to_json(JSON, [])
|
try term_to_json(JSON, [])
|
||||||
%% rethrow exception so internals aren't confusingly exposed to users
|
%% rethrow exception so internals aren't confusingly exposed to users
|
||||||
catch error:badarg -> erlang:error(badarg)
|
catch error:badarg -> erlang:error(badarg,[JSON])
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ term_to_json(JSON) ->
|
||||||
term_to_json(JSON, Opts) ->
|
term_to_json(JSON, Opts) ->
|
||||||
try jsx_eep0018:term_to_json(JSON, Opts)
|
try jsx_eep0018:term_to_json(JSON, Opts)
|
||||||
%% rethrow exception so internals aren't confusingly exposed to users
|
%% rethrow exception so internals aren't confusingly exposed to users
|
||||||
catch error:badarg -> erlang:error(badarg)
|
catch error:badarg -> erlang:error(badarg,[JSON,Opts])
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue