JSON encoder error codes
#include <sys/json.h>
typedef enum {
JSON_ENCODER_OK = 0,
JSON_ENCODER_NO_MEMORY = 1,
JSON_ENCODER_BAD_NESTING = 2,
JSON_ENCODER_INVALID_VALUE = 3,
JSON_ENCODER_MISSING_PROPERTY_NAME = 4,
JSON_ENCODER_NOT_FOUND = 5,
JSON_ENCODER_NOT_SUPPORTED = 6,
JSON_ENCODER_TOO_MANY_VALUES = 7,
JSON_ENCODER_UNEXPECTED_NAME = 8,
JSON_ENCODER_MAX_LEVEL_REACHED = 9,
JSON_ENCODER_INVALID_STATE = 10,
JSON_ENCODER_EXTERNAL_ERROR = 11
} json_encoder_error_t;
No error condition exists.
The operation failed to allocate memory.
Encoding failed because of improper object or array nesting.
Encoding failed because of an invalid value.
Encoding failed attempting to add a value with no property name.
Encoding failed attempting to encode from a non-existent node of a decoder.
The operation is not supported.
Encoding failed attempting to add a second value when only a single value is allowed.
Encoding failed attempting to add a named property when only nameless elements are allowed (e.g., within an array).
Encoding failed attempting to exceed the maximum nesting level.
The state provided to json_encoder_set_state() was invalid.
An external error occurred. This is not used internally but may be set via json_encoder_set_status() to signal a caller-detected error.
These error codes are returned with most json_encoder_*() function calls during encoding operations, and are also available through json_encoder_get_status().