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

新增 错误码

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