Previous: , Up: Error Handling   [Contents][Index]


5.17.2 Error Functions

shishi_strerror

Function: const char * shishi_strerror (int err)

err: shishi error code.

Description: Converts the return code in err to a human readable string.

Return value: Returns a pointer to a statically allocated string containing a description of the error with code err. This string can be used to output a diagnostic message to the user.

shishi_error

Function: const char * shishi_error (Shishi * handle)

handle: shishi handle as allocated by shishi_init().

Description: Extracts detailed information on the most recently occurred error condition. Note that memory is managed by the Shishi library, so the returned string must not be deallocated.

Return value: Returns a pointer to a string describing an error. The string must not be deallocated by the caller.

shishi_error_clear

Function: void shishi_error_clear (Shishi * handle)

handle: shishi handle as allocated by shishi_init().

Description: Clears the internal error description. See shishi_error() on how to access the error string, and shishi_error_set() as well as shishi_error_printf() on how to set the error string.

This function is mostly for Shishi’s internal use, but if you develop an extension of Shishi, it may be useful to support the same error handling infrastructure.

shishi_error_set

Function: void shishi_error_set (Shishi * handle, const char * errstr)

handle: shishi handle as allocated by shishi_init().
errstr: A null-terminated character string holding a description, or NULL to clear the internal error string.

Description: Sets the error description to the content of errstr. The string is copied into the Shishi internal structure, so you can deallocate any string passed to this function.

This function is mostly for Shishi’s internal use, but if you develop an extension of Shishi, it may be useful to support the same error handling infrastructure.

shishi_error_printf

Function: void shishi_error_printf (Shishi * handle, const char * format, ...)

handle: shishi handle as allocated by shishi_init().
format: printf style format string.
...: printf style arguments.

Description: Sets the internal error description to a printf(3) formatted string. This function is mostly for Shishi’s internal use, but if you develop an extension of Shishi, it may be useful to support the same infrastructure for error handling.

shishi_error_outputtype

Function: int shishi_error_outputtype (Shishi * handle)

handle: shishi handle as allocated by shishi_init().

Description: Reports the current output type used in message logging.

Return value: Returns the output type. SHISHI_OUTPUTTYPE_NULL means no output. SHISHI_OUTPUTTYPE_STDERR and SHISHI_OUTPUTTYPE_SYSLOG direct text to the console, or to the syslog system.

shishi_error_set_outputtype

Function: void shishi_error_set_outputtype (Shishi * handle, int type)

handle: shishi handle as allocated by shishi_init().
type: output type, of enum type Shishi_outputtype.

Description: Sets the output type (NULL, stderr or syslog) used for information and warning messages. Intended values are SHISHI_OUTPUTTYPE_NULL, for no output at all, SHISHI_OUTPUTTYPE_STDERR for output to the console, and SHISHI_OUTPUTTYPE_SYSLOG for syslog messaging. The first value covers everything different from the latter two values.

shishi_info

Function: void shishi_info (Shishi * handle, const char * format, ...)

handle: shishi handle as allocated by shishi_init().
format: printf style format string.
...: printf style arguments.

Description: Prints an informational message, composed from the arguments, to the output stream set in handle.

shishi_warn

Function: void shishi_warn (Shishi * handle, const char * format, ...)

handle: shishi handle as allocated by shishi_init().
format: printf style format string.
...: printf style arguments.

Description: Prints a warning, composed from the arguments, to the output stream set in handle.

shishi_verbose

Function: void shishi_verbose (Shishi * handle, const char * format, ...)

handle: shishi handle as allocated by shishi_init().
format: printf style format string.
...: printf style arguments.

Description: Prints a diagnostic message, composed from the arguments, to the output stream set in handle. The current verbosity setting determines whether the message is actually printed, or is suppressed due to low significance.


Previous: , Up: Error Handling   [Contents][Index]