Status

Status codes and return values used for error handling.

Success and various specific errors are reported by an integer status code, which can be converted to a string to produce friendly error messages. Reading and writing functions return a “result”, which has a status code along with a count of bytes read or written.

struct ExessResult

Result returned from a read or write function.

This combines a status code with a byte offset, so it can be used to determine how many characters were read or written, or what error occurred at what character offset.

ExessStatus status

Status code.

size_t count

Number of bytes read or written, excluding null.

enum ExessStatus

Status code to describe errors or other relevant situations.

enumerator EXESS_SUCCESS

Success.

enumerator EXESS_EXPECTED_END

Expected end of value.

enumerator EXESS_EXPECTED_BOOLEAN

Expected “false”, “true”, “0” or “1”.

enumerator EXESS_EXPECTED_INTEGER

Expected an integer value.

enumerator EXESS_EXPECTED_DURATION

Expected a duration starting with ‘P’.

enumerator EXESS_EXPECTED_SIGN

Expected ‘-‘ or ‘+’.

enumerator EXESS_EXPECTED_DIGIT

Expected a digit.

enumerator EXESS_EXPECTED_COLON

Expected ‘:’.

enumerator EXESS_EXPECTED_DASH

Expected ‘-‘.

enumerator EXESS_EXPECTED_TIME_SEP

Expected ‘T’.

enumerator EXESS_EXPECTED_TIME_TAG

Expected ‘H’, ‘M’, or ‘S’.

enumerator EXESS_EXPECTED_DATE_TAG

Expected ‘Y’, ‘M’, or ‘D’.

enumerator EXESS_EXPECTED_HEX

Expected a hexadecimal character.

enumerator EXESS_EXPECTED_BASE64

Expected a base64 character.

enumerator EXESS_BAD_ORDER

Invalid field order.

enumerator EXESS_BAD_VALUE

Invalid value.

enumerator EXESS_OUT_OF_RANGE

Value out of range for datatype.

enumerator EXESS_NO_SPACE

Insufficient space.

enumerator EXESS_WOULD_REDUCE_PRECISION

Precision reducing coercion required.

enumerator EXESS_WOULD_ROUND

Rounding coercion required.

enumerator EXESS_WOULD_TRUNCATE

Truncating coercion required.

enumerator EXESS_UNSUPPORTED

Unsupported value.

const char *exess_strerror(ExessStatus status)

Return a string describing a status code in plain English.

The returned string is always one sentence, with an uppercase first character, and no trailing period.