f75957ab6b
error code and message are generated at compile time by reading a json file which contains information of elements for each error code. This framework provides error handling and ability to do more cleaner log messages to users. error-codes.json file contains error description is below format { "ERR_NAME": {"code": ERR_NUM, "message": {"LOCALE": "ERR_MESSAGE"}} } At compile time autogen.sh calls gen-headers.py which produces C header file libglusterfs/src/gf-error-codes.h. This header has a function const char *_gf_get_message (int code); which returns respective ERR_MESSAGE for given ERR_NUM. Change-Id: Ieefbf4c470e19a0175c28942e56cec98a3c94ff0 BUG: 928648 Signed-off-by: Bala.FA <barumuga@redhat.com> Reviewed-on: http://review.gluster.org/4977 Reviewed-by: Niels de Vos <ndevos@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
34 lines
904 B
Plaintext
34 lines
904 B
Plaintext
/***************************************************************/
|
|
/** **/
|
|
/** DO NOT EDIT THIS FILE **/
|
|
/** THIS IS AUTO-GENERATED FROM LOG BOOK **/
|
|
/** YOUR CHANGES WILL BE LOST IN NEXT BUILD **/
|
|
/** **/
|
|
/***************************************************************/
|
|
|
|
#ifndef _GF_ERROR_CODES_H
|
|
#define _GF_ERROR_CODES_H
|
|
|
|
#include <libintl.h>
|
|
|
|
#define _(STRING) gettext(STRING)
|
|
|
|
|
|
/** START: ERROR CODE DEFINITIONS **/
|
|
$DEFINES
|
|
/** END: ERROR CODE DEFINITIONS **/
|
|
|
|
|
|
/** START: FUNCTION RETURNS MESSAGE OF GIVEN ERROR CODE **/
|
|
const char *
|
|
_gf_get_message (int code) {
|
|
switch (code) {
|
|
$CASES
|
|
default: return NULL;
|
|
}
|
|
}
|
|
/** END: FUNCTION RETURNS MESSAGE OF GIVEN ERROR CODE **/
|
|
|
|
|
|
#endif
|