sile / jsone

Erlang JSON library
MIT License
291 stars 71 forks source link

Fix `jsone:try_encode({{json_utf8, IncompleteUtf8}})` raises a `try_clause` exception. #81

Closed sile closed 11 months ago

sile commented 11 months ago

{{jsone_utf8, _}} feature was introduced in #11, but it turned out that the current implementation doesn't consider that unicode:characters_to_binary/1 could return {incomplete, _, _} tuple as the result. If the tuple is returned, try_encode() method raises an (unintended) exception. This PR fixes this problem.

codecov-commenter commented 11 months ago

Codecov Report

Merging #81 (caec6ba) into master (8250f55) will increase coverage by 0.32%. The diff coverage is 100.00%.

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

@@            Coverage Diff             @@
##           master      #81      +/-   ##
==========================================
+ Coverage   91.91%   92.23%   +0.32%     
==========================================
  Files           4        4              
  Lines         334      335       +1     
==========================================
+ Hits          307      309       +2     
+ Misses         27       26       -1     
Files Changed Coverage Δ
src/jsone_encode.erl 87.17% <100.00%> (+0.72%) :arrow_up: