Go to the documentation of this file.
23 #ifndef __STUMPLESS_ERROR_H
24 # define __STUMPLESS_ERROR_H
38 #define STUMPLESS_FOREACH_ERROR(ERROR) \
44 ERROR(STUMPLESS_ADDRESS_FAILURE, 0) \
46 ERROR(STUMPLESS_ARGUMENT_EMPTY, 1) \
48 ERROR(STUMPLESS_ARGUMENT_TOO_BIG, 2) \
54 ERROR(STUMPLESS_DUPLICATE_ELEMENT, 3) \
60 ERROR(STUMPLESS_ELEMENT_NOT_FOUND, 4) \
62 ERROR(STUMPLESS_FILE_OPEN_FAILURE, 5) \
64 ERROR(STUMPLESS_FILE_WRITE_FAILURE, 6) \
66 ERROR(STUMPLESS_INDEX_OUT_OF_BOUNDS, 7) \
68 ERROR(STUMPLESS_INVALID_FACILITY, 8) \
70 ERROR(STUMPLESS_INVALID_ID, 9) \
76 ERROR(STUMPLESS_INVALID_SEVERITY, 10) \
78 ERROR(STUMPLESS_MEMORY_ALLOCATION_FAILURE, 11) \
80 ERROR(STUMPLESS_NETWORK_PROTOCOL_UNSUPPORTED, 12) \
86 ERROR(STUMPLESS_PARAM_NOT_FOUND, 13) \
88 ERROR(STUMPLESS_SOCKET_BIND_FAILURE, 14) \
90 ERROR(STUMPLESS_SOCKET_CONNECT_FAILURE, 15) \
92 ERROR(STUMPLESS_SOCKET_FAILURE, 16) \
94 ERROR(STUMPLESS_SOCKET_SEND_FAILURE, 17) \
96 ERROR(STUMPLESS_STREAM_WRITE_FAILURE, 18) \
98 ERROR(STUMPLESS_TARGET_INCOMPATIBLE, 19) \
100 ERROR(STUMPLESS_TARGET_UNSUPPORTED, 20) \
102 ERROR(STUMPLESS_TRANSPORT_PROTOCOL_UNSUPPORTED, 21) \
104 ERROR(STUMPLESS_WINDOWS_EVENT_LOG_CLOSE_FAILURE, 22) \
106 ERROR(STUMPLESS_WINDOWS_EVENT_LOG_OPEN_FAILURE, 23) \
108 ERROR(STUMPLESS_INVALID_ENCODING, 24) \
110 ERROR(STUMPLESS_GETHOSTNAME_FAILURE, 25 ) \
116 ERROR(STUMPLESS_FUNCTION_TARGET_FAILURE, 26 ) \
122 ERROR( STUMPLESS_JOURNALD_FAILURE, 27 ) \
129 ERROR( STUMPLESS_WINDOWS_FAILURE, 28 )
stumpless_error_id
An (enum) identifier of the types of errors that might be encountered.
Definition: error.h:108
Information describing an error encountered by the library.
Definition: error.h:115
#define STUMPLESS_GENERATE_ENUM(NAME, VALUE)
Returns a definition of a symbol with the given name and value fit for use in an enum definition.
Definition: generator.h:33
const char * code_type
a description of the error code
Definition: error.h:119
bool stumpless_has_error(void)
True if the last call to a stumpless function encountered an error.
void stumpless_perror(const char *prefix)
Prints information about the current error to the error stream.
#define STUMPLESS_FOREACH_ERROR(ERROR)
A macro to implement error id enum and error string array.
Definition: error.h:38
const struct stumpless_error * stumpless_get_error(void)
Retrieves the error encountered by the last library call.
void stumpless_set_error_stream(FILE *stream)
Sets the stream to write errors to.
const char * stumpless_get_error_id_string(enum stumpless_error_id id)
Gets the error string of the given error id.
enum stumpless_error_id id
error family
Definition: error.h:116
const char * message
specific details of the failure
Definition: error.h:117
#define STUMPLESS_PUBLIC_FUNCTION
Marks functions that are provided for use by the library.
Definition: config.h:31
enum stumpless_error_id stumpless_get_error_id(const struct stumpless_error *err)
Gets the error id of the given error.
int code
an error code possibly providing more information
Definition: error.h:118
FILE * stumpless_get_error_stream(void)
Gets the current stream that errors are written to.