| PolicyKit Library Reference Manual | ||||
|---|---|---|---|---|
enum PolKitErrorCode; PolKitError; polkit_bool_t polkit_error_is_set (PolKitError *error); const char* polkit_error_get_error_name (PolKitError *error); PolKitErrorCode polkit_error_get_error_code (PolKitError *error); const char* polkit_error_get_error_message (PolKitError *error); void polkit_error_free (PolKitError *error); polkit_bool_t polkit_error_set_error (PolKitError **error, PolKitErrorCode error_code, const char *format, ...);
typedef enum
{
POLKIT_ERROR_OUT_OF_MEMORY,
POLKIT_ERROR_POLICY_FILE_INVALID,
POLKIT_ERROR_GENERAL_ERROR,
POLKIT_ERROR_NOT_AUTHORIZED_TO_READ_AUTHORIZATIONS_FOR_OTHER_USERS,
POLKIT_ERROR_NOT_AUTHORIZED_TO_REVOKE_AUTHORIZATIONS_FROM_OTHER_USERS,
POLKIT_ERROR_NOT_AUTHORIZED_TO_GRANT_AUTHORIZATION,
POLKIT_ERROR_AUTHORIZATION_ALREADY_EXISTS,
POLKIT_ERROR_NOT_SUPPORTED,
POLKIT_ERROR_NOT_AUTHORIZED_TO_MODIFY_DEFAULTS,
POLKIT_ERROR_NUM_ERROR_CODES
} PolKitErrorCode;
Errors returned by PolicyKit
typedef struct _PolKitError PolKitError;
Objects of this class are used for error reporting.
polkit_bool_t polkit_error_is_set (PolKitError *error);
Determine if an error set
| error : | the error |
| Returns : | TRUE if, and only if, the error is set |
Since 0.7
const char* polkit_error_get_error_name (PolKitError *error);
Get the CamelCase name for the error; e.g. POLKIT_ERROR_OUT_OF_MEMORY maps to "OutOfMemory" and so on.
| error : | the error |
| Returns : | the string |
Since 0.7
PolKitErrorCode polkit_error_get_error_code (PolKitError *error);
Returns the error code.
| error : | the error object |
| Returns : | A value from the PolKitErrorCode enumeration. |
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_bool_t 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 |
| Returns : | TRUE if the error was set |