Error reporting

Error reporting — Representation of recoverable errors.

Synopsis




enum                PolKitErrorCode;
                    PolKitError;
PolKitErrorCode     polkit_error_get_error_code         (PolKitError *error);
const char*         polkit_error_get_error_message      (PolKitError *error);
void                polkit_error_free                   (PolKitError *error);
void                polkit_error_set_error              (PolKitError **error,
                                                         PolKitErrorCode error_code,
                                                         const char *format,
                                                         ...);

Description

Error codes from PolicyKit.

Details

enum PolKitErrorCode

typedef enum
{      
        POLKIT_ERROR_OUT_OF_MEMORY,
        POLKIT_ERROR_POLICY_FILE_INVALID
} PolKitErrorCode;

Error codes returned by PolicyKit

POLKIT_ERROR_OUT_OF_MEMORY

Out of memory

POLKIT_ERROR_POLICY_FILE_INVALID

There was an error parsing the given policy file

PolKitError

typedef struct _PolKitError PolKitError;

Objects of this class are used for error reporting.


polkit_error_get_error_code ()

PolKitErrorCode     polkit_error_get_error_code         (PolKitError *error);

Returns the error code.

error :

the error object

Returns :

A value from the PolKitErrorCode enumeration.

polkit_error_get_error_message ()

const char*         polkit_error_get_error_message      (PolKitError *error);

Get the error message.

error :

the error object

Returns :

A string describing the error. Caller shall not free this string.

polkit_error_free ()

void                polkit_error_free                   (PolKitError *error);

Free an error.

error :

the error

polkit_error_set_error ()

void                polkit_error_set_error              (PolKitError **error,
                                                         PolKitErrorCode error_code,
                                                         const char *format,
                                                         ...);

Sets an error. If OOM, the error will be set to a pre-allocated OOM error.

error :

the error object

error_code :

A value from the PolKitErrorCode enumeration.

format :

printf style formatting string

... :

printf style arguments