Handling Error

Errno json values

Like the C library, this library uses an errno to indicate what went wrrong. The json_errno’s value is significant only when the return value of the call indicated an error (e.g. b JSON_EF).

group ErrorErrno

Defines

json_errno

Just a simple define to simplify the access to the errno’s value.

Functions

unsigned char *json_errno_location(void)

Internal purpose only

The internal errno function of this library.

void json_print_error(FILE *stream)

This function writes an error accordong to the value or json_errno.

group ErrorErrnoValues

Enums

enum json_errno_code_t

Values:

enumerator JSON_E_DEFAULT

Default value

enumerator JSON_E_SYS_FAILURE

Set when a call to a system function has failed (e.g.: malloc).

enumerator JSON_E_UNMATCHED_QUOTE

Parser: Set when an unmatched quote was found during the parsing.

enumerator JSON_E_UNKNOW_TYPE

Parser: Set when an unknow token was encountered during the parsing.

enumerator JSON_E_END_OF_FILE

Internal purpose only

Parser: Set when the parser has reached the end of the file descriptor but the parsed json is imcomplete.

enumerator JSON_E_SYNTHAX

Parser: Set when the token find by the parser isn’t an expected token type.

enumerator JSON_E_KEY_DUPLICATED

Parser: Set when the parser found a duplicated key in an object.

enumerator JSON_E_INVALID_EOF

Parser: Set when the parser reached the end of the file/str but hasn’t reached the closing bracket.

enumerator JSON_E_KEY_ALREADY_EXIST

Set when when the append value in an object has a key which already exist in that object.

enumerator JSON_E_COUNT

Internal purpose only

json_errno is never set to this value.