hkl-error

hkl-error

Synopsis

                    HklError;
HklError*           hkl_error_new                       (const char *format,
                                                         ...);
HklError*           hkl_error_new_literal               (const char *message);
HklError*           hkl_error_new_valist                (const char *format,
                                                         va_list args);
void                hkl_error_free                      (HklError *error);
HklError*           hkl_error_new_copy                  (const HklError *error);
void                hkl_error_set                       (HklError **err,
                                                         const char *format,
                                                         ...);
void                hkl_error_set_literal               (HklError **err,
                                                         const char *message);
void                hkl_error_propagate                 (HklError **dest,
                                                         HklError *src);
void                hkl_error_clear                     (HklError **err);
void                hkl_error_prefix                    (HklError **err,
                                                         const char *format,
                                                         ...);
void                hkl_error_propagate_prefixed        (HklError **dest,
                                                         HklError *src,
                                                         const char *format,
                                                         ...);

Description

Details

HklError

typedef struct {
	char *message;
} HklError;


hkl_error_new ()

HklError*           hkl_error_new                       (const char *format,
                                                         ...);

Creates a new HklError with the given, and a message formatted with format.

format :

printf()-style format for error message

... :

parameters for message format

Returns :

a new HklError

hkl_error_new_literal ()

HklError*           hkl_error_new_literal               (const char *message);

Creates a new HklError; unlike hkl_error_new(), message is not a printf()-style format string. Use this function if message contains text you don't have control over, that could include printf() escape sequences.

message :

error message

Returns :

a new HklError

hkl_error_new_valist ()

HklError*           hkl_error_new_valist                (const char *format,
                                                         va_list args);

Creates a new HklError with the given message formatted with format.

format :

printf()-style format for error message

args :

va_list of parameters for the message format

Returns :

a new HklError

Since 2.22


hkl_error_free ()

void                hkl_error_free                      (HklError *error);

Frees a HklError and associated resources.

error :

a HklError

hkl_error_new_copy ()

HklError*           hkl_error_new_copy                  (const HklError *error);

error :

Returns :


hkl_error_set ()

void                hkl_error_set                       (HklError **err,
                                                         const char *format,
                                                         ...);

Does nothing if err is NULL; if err is non-NULL, then *err must be NULL. A new HklError is created and assigned to *err.

err :

a return location for a HklError, or NULL

format :

printf()-style format

... :

args for format

hkl_error_set_literal ()

void                hkl_error_set_literal               (HklError **err,
                                                         const char *message);

Does nothing if err is NULL; if err is non-NULL, then *err must be NULL. A new HklError is created and assigned to *err. Unlike hkl_set_error(), message is not a printf()-style format string. Use this function if message contains text you don't have control over, that could include printf() escape sequences.

err :

a return location for a HklError, or NULL

message :

error message

Since 2.18


hkl_error_propagate ()

void                hkl_error_propagate                 (HklError **dest,
                                                         HklError *src);

dest :

src :


hkl_error_clear ()

void                hkl_error_clear                     (HklError **err);

err :


hkl_error_prefix ()

void                hkl_error_prefix                    (HklError **err,
                                                         const char *format,
                                                         ...);

err :

format :

... :


hkl_error_propagate_prefixed ()

void                hkl_error_propagate_prefixed        (HklError **dest,
                                                         HklError *src,
                                                         const char *format,
                                                         ...);

dest :

src :

format :

... :