eolib 0.5.0
A core C library for writing applications related to Endless Online
Loading...
Searching...
No Matches
Error Handling

Nearly every function in eolib-c returns an EoResult value. A return value of EO_SUCCESS (0) indicates success; any other value indicates a specific failure condition.

Use eo_result_string() to obtain a human-readable description of an error.

Typical pattern:

EoResult result = eo_writer_add_short(&writer, 1234);
if (result != EO_SUCCESS) {
fprintf(stderr, "write failed: %s\n", eo_result_string(result));
eo_writer_free(&writer);
return;
}
EoResult eo_writer_add_short(EoWriter *writer, int32_t value)
Definition data.c:469
EoWriter eo_writer_init(void)
Definition data.c:216
void eo_writer_free(EoWriter *writer)
Definition data.c:231
const char * eo_result_string(EoResult result)
Definition data.c:175
EoResult
Definition result.h:12
@ EO_SUCCESS
Definition result.h:14

Error codes:

Code Meaning
EO_SUCCESS Operation succeeded
EO_NULL_PTR A required pointer argument was NULL
EO_OVERFLOW An internal size calculation would overflow
EO_ALLOC_FAILED A memory allocation failed
EO_NUMBER_TOO_LARGE Value exceeds EO_INT_MAX
EO_BUFFER_UNDERRUN Not enough bytes remaining to complete a read
EO_CHUNKED_MODE_DISABLED A chunked-mode operation was attempted with chunked reading disabled
EO_INVALID_SEQUENCE_RANGE The sequence start value is out of range
EO_SEQUENCE_OUT_OF_RANGE A sequence byte could not be encoded as a single EO char
EO_INVALID_DATA Structural mismatch in the data
EO_STR_OUT_OF_RANGE A string is longer than the specified fixed length
EO_STR_TOO_SHORT A string is shorter than the required fixed length