Merge pull request #381 from phst/end-of-file-error-code

Use a more specific error code for premature end of input
This commit is contained in:
Petri Lehtinen
2018-02-09 09:40:42 +02:00
committed by GitHub
2 changed files with 12 additions and 0 deletions

View File

@@ -122,6 +122,10 @@ static void error_set(json_error_t *error, const lex_t *lex,
}
else
{
if(code == json_error_invalid_syntax) {
/* More specific error code for premature end of file. */
code = json_error_premature_end_of_input;
}
if(lex->stream.state == STREAM_STATE_ERROR) {
/* No context for UTF-8 decoding errors */
result = msg_text;