kore-doc

The kore documentation found under https://docs.kore.io/
Commits | Files | Refs | README | git clone https://git.kore.io/kore-doc.git

commit e5839055946696f0406392ec69b05e42afcf2ba7
parent 666aec7eaacc3539a98c707bb7254a3ce59ce0d1
Author: Joris Vink <joris@coders.se>
Date:   Mon, 31 Aug 2020 14:05:42 +0200

add missing strerror

Diffstat:
api/json.md | 29++++++++++++++++++++++++++---
1 file changed, 26 insertions(+), 3 deletions(-)

diff --git a/api/json.md b/api/json.md @@ -33,7 +33,7 @@ See the included [example](https://github.com/jorisvink/kore/tree/master/example void kore_json_init(struct kore_json *json, const u_int8_t *data, size_t len); ``` ### Description -Initializes a **kore\_json** context. This must be called before any other +Initializes a **kore_json** context. This must be called before any other function can be safely used. | Parameter | Description | @@ -52,7 +52,7 @@ Nothing void kore_json_cleanup(struct kore_json *json); ``` ### Description -Cleanup the **kore\_json** context and release all associated resources. +Cleanup the **kore_json** context and release all associated resources. This must be called when you no longer need the context. | Parameter | Description | @@ -69,7 +69,7 @@ Nothing int kore_json_parse(struct kore_json *json); ``` ### Description -Parse the JSON data that was set via **kore\_json\_init**. +Parse the JSON data that was set via **kore_json_init**. | Parameter | Description | | -- | -- | @@ -392,3 +392,26 @@ if something has failed. if (kore_json_create_literal(parent, "istrue", KORE_JSON_FALSE) == NULL) /* handle */ ``` + +--- +# kore\_json\_strerror {#strerror} +### Synopsis +``` +const char *kore_json_strerror(struct kore_json *json); +``` +### Description +Returns a human readable string for the error that occurred in the context. + +| Parameter | Description | +| -- | -- | +| json | A kore\_json context in which an error occurred. | + +### Returns +A pointer to a human readable string that describes the error. +This pointer should not be freed by the caller. + +### Example + +```c +kore_log(LOG_INFO, "parsing error '%s'", kore_json_strerror(&json)); +```