[augeas-devel] Error reporting API

David Lutterkort lutter at redhat.com
Tue Sep 22 00:54:39 UTC 2009


On Mon, 2009-09-21 at 17:48 -0700, David Lutterkort wrote:
> This change has been long overdue: API functions to inquire about errors
> and details about them. The function aug_error can be used to get an error
> code for whatever error made the last aug_* fail.

The functions for dealing with errors are in augeas.h; they are:

        typedef enum {
            AUG_NOERROR,        /* No error */
            AUG_ENOMEM,         /* Out of memory */
            AUG_EINTERNAL,      /* Internal error (bug) */
            AUG_EPATHX,         /* Invalid path expression */
            AUG_ENOMATCH,       /* No match for path expression */
            AUG_EMMATCH         /* Too many matches for path expression */
        } aug_errcode_t;
        
        /* Return the error code from the last API call */
        int aug_error(augeas *aug);
        
        /* Return a human-readable message for the error code */
        const char *aug_error_message(augeas *aug);
        
        /* Return a human-readable message elaborating the error code; might be
         * NULL. For example, when the error code is AUG_EPATHX, this will explain
         * how the path expression is invalid */
        const char *aug_error_minor_message(augeas *aug);
        
        /* Return details about the error, which might be NULL. For example, for
         * AUG_EPATHX, indicates where in the path expression the error
         * occurred. The returned value can only be used until the next API call
         */
        const char *aug_error_details(augeas *aug);
        
David





More information about the augeas-devel mailing list