[augeas-devel] Error reporting API

Jeff Johnson n3npq at mac.com
Tue Sep 22 01:03:21 UTC 2009


On Sep 21, 2009, at 8:54 PM, David Lutterkort wrote:

> 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);
>

Nothing wrong with all of the above at all.

However it is a PULL interface rather than a PUSH interface, i.e.

	Why not add a callback PUSH into the Augeas API as well?

But sure I'm used to checking return codes and PULL'ing additional
info whene needed, the above is more than adequate.

73 de Jeff




More information about the augeas-devel mailing list