提交 ea54c423 authored 作者: zhoush's avatar zhoush

新增 错误码

上级 72842417
......@@ -14,32 +14,34 @@
*
* @note add your own (error macro, error description) map here
*/
#define AW_ERRNO_MAP(XX) \
/* no error */ \
XX(SUCC, "SUCCESS") \
\
/* use system errno */ \
XX(ERR_SYS, "Use strerror instead") \
\
/* SQLite error */ \
XX(ERR_SQLITE, "Call sqlite_errmsg() after") \
XX(ERR_SQLITE_NOT_FOUND, "No result found") \
\
/* MySQL error */ \
XX(ERR_MYSQL, "Call mysql_error() for detail ") \
\
/* Custom error */ \
XX(ERR_INVALID_ADDR, "Invalid memory address") \
XX(ERR_INVALID_TYPE, "Invalid data type") \
XX(ERR_NO_MEMORY, "No enough memory") \
XX(ERR_NO_FILE, "Check if file exists") \
XX(ERR_NO_DATA, "No data found") \
\
XX(ERR_SQL_INVALID_METHOD, "Invalid sql method") \
XX(ERR_SQL_CONN, "Connect error, check parameters") \
\
/* unknown error */ \
XX(ERR_UNKNOWN, "Unexpected error occurred")
#define AW_ERRNO_MAP(XX) \
/* no error */ \
XX(SUCC, "SUCCESS") \
\
/* use system errno */ \
XX(ERR_SYS, "Use strerror instead") \
\
/* SQLite error */ \
XX(ERR_SQLITE, "Call sqlite_errmsg() after") \
XX(ERR_SQLITE_NOT_FOUND, "No result found") \
\
/* MySQL error */ \
XX(ERR_MYSQL, "Call mysql_error() for detail ") \
\
/* Custom error */ \
XX(ERR_INVALID_ADDR, "Invalid memory address") \
XX(ERR_INVALID_TYPE, "Invalid data type") \
XX(ERR_NO_MEMORY, "No enough memory") \
XX(ERR_NO_FILE, "Check if file exists") \
XX(ERR_NO_DATA, "No data found") \
\
XX(ERR_SQL_INVALID_METHOD, "Invalid sql method") \
XX(ERR_SQL_CONN, "Connect error, check parameters") \
\
XX(ERR_INVALID_LENGTH, "Invalid length") \
XX(ERR_INVALID_DATA, "Invalid data") \
/* unknown error */ \
XX(ERR_UNKNOWN, "Unexpected error occurred")
/**
* @brief Define AW_* values for each errno value above
......@@ -53,14 +55,10 @@
*
* @warning DO NOT DO ANY EDIT HERE
*/
typedef enum
{
AW_FAIL = -1,
AW_ERRNO_MAP(AW_ERRNO_GEN)
} AW_errno;
typedef enum { AW_FAIL = -1, AW_ERRNO_MAP(AW_ERRNO_GEN) } AW_errno;
#undef AW_ERRNO_GEN
const char *AW_ERR_desc(AW_errno errnum) __attribute__ ((deprecated ("use AW_strerror instead")));
const char *AW_ERR_desc(AW_errno errnum) __attribute__((deprecated("use AW_strerror instead")));
const char *AW_strerror(AW_errno errnum);
extern _Thread_local AW_errno AW_errnum;
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论