aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2021-09-09 13:57:43 -0400
committerDavid Robillard <d@drobilla.net>2022-01-28 21:57:07 -0500
commitbd24b8f6d558bafbbb16d9490ebe3478dbf130bd (patch)
tree592c5ebc7694a80952b193de0adea0f4e640ec65 /include
parent1fb84760a8230637a806e8e83410fc7fb6d446d2 (diff)
downloadserd-bd24b8f6d558bafbbb16d9490ebe3478dbf130bd.tar.gz
serd-bd24b8f6d558bafbbb16d9490ebe3478dbf130bd.tar.bz2
serd-bd24b8f6d558bafbbb16d9490ebe3478dbf130bd.zip
Use more human-readable status codes
Diffstat (limited to 'include')
-rw-r--r--include/serd/serd.h53
1 files changed, 28 insertions, 25 deletions
diff --git a/include/serd/serd.h b/include/serd/serd.h
index 9eb84a6a..b70500c1 100644
--- a/include/serd/serd.h
+++ b/include/serd/serd.h
@@ -217,24 +217,28 @@ serd_free(void* SERD_NULLABLE ptr);
/// Return status code
typedef enum {
- SERD_SUCCESS, ///< No error
- SERD_FAILURE, ///< Non-fatal failure
- SERD_ERR_UNKNOWN, ///< Unknown error
- SERD_ERR_BAD_SYNTAX, ///< Invalid syntax
- SERD_ERR_BAD_ARG, ///< Invalid argument
- SERD_ERR_BAD_CURSOR, ///< Use of invalidated cursor
- SERD_ERR_NOT_FOUND, ///< Not found
- SERD_ERR_ID_CLASH, ///< Encountered clashing blank node IDs
- SERD_ERR_BAD_CURIE, ///< Invalid CURIE or unknown namespace prefix
- SERD_ERR_INTERNAL, ///< Unexpected internal error
- SERD_ERR_OVERFLOW, ///< Stack overflow
- SERD_ERR_BAD_TEXT, ///< Invalid text encoding
- SERD_ERR_BAD_WRITE, ///< Error writing to file/stream
- SERD_ERR_NO_DATA, ///< Unexpected end of input
- SERD_ERR_BAD_CALL, ///< Invalid call
- SERD_ERR_BAD_URI, ///< Invalid or unresolved URI
- SERD_ERR_BAD_INDEX, ///< No optimal model index available
- SERD_ERR_INVALID, ///< Invalid data
+ SERD_SUCCESS, ///< Success
+ SERD_FAILURE, ///< Non-fatal failure
+ SERD_UNKNOWN_ERROR, ///< Unknown error
+ SERD_NO_DATA, ///< Missing input
+ SERD_OVERFLOW, ///< Insufficient space
+
+ SERD_BAD_ALLOC, ///< Memory allocation failed
+ SERD_BAD_ARG, ///< Invalid argument
+ SERD_BAD_CALL, ///< Invalid call
+ SERD_BAD_CURIE, ///< Invalid CURIE or unknown namespace prefix
+ SERD_BAD_CURSOR, ///< Use of invalidated cursor
+ SERD_BAD_EVENT, ///< Invalid event in stream
+ SERD_BAD_INDEX, ///< No optimal model index available
+ SERD_BAD_LABEL, ///< Encountered clashing blank node label
+ SERD_BAD_LITERAL, ///< Invalid literal
+ SERD_BAD_PATTERN, ///< Invalid statement pattern
+ SERD_BAD_READ, ///< Error reading from file
+ SERD_BAD_STACK, ///< Stack overflow
+ SERD_BAD_SYNTAX, ///< Invalid syntax
+ SERD_BAD_TEXT, ///< Invalid text encoding
+ SERD_BAD_URI, ///< Invalid or unresolved URI
+ SERD_BAD_WRITE, ///< Error writing to file
} SerdStatus;
/**
@@ -255,9 +259,8 @@ typedef struct {
/**
Number of bytes written or required.
- On success, this is the total number of bytes written. On
- #SERD_ERR_OVERFLOW, this is the number of bytes of output space that are
- required for success.
+ On success, this is the total number of bytes written. On #SERD_OVERFLOW,
+ this is the number of bytes of output space that are required for success.
*/
size_t count;
} SerdWriteResult;
@@ -674,8 +677,8 @@ typedef enum {
Otherwise, it is ignored.
@return A result with a `status` and a `count` of bytes written. If the
- buffer is too small for the node, then `status` will be #SERD_ERR_OVERFLOW,
- and `count` will be set to the number of bytes required to successfully
+ buffer is too small for the node, then `status` will be #SERD_OVERFLOW, and
+ `count` will be set to the number of bytes required to successfully
construct the node.
*/
SERD_API
@@ -1107,8 +1110,8 @@ serd_get_base64_size(const SerdNode* SERD_NONNULL node);
@param buf Buffer where decoded data will be written.
@return On success, #SERD_SUCCESS is returned along with the number of bytes
- written. If the output buffer is too small, then #SERD_ERR_OVERFLOW is
- returned along with the number of bytes required for successful decoding.
+ written. If the output buffer is too small, then #SERD_OVERFLOW is returned
+ along with the number of bytes required for successful decoding.
*/
SERD_API
SerdWriteResult