Add errcode header

This commit is contained in:
Kirigaya Kazuto 2017-11-20 09:07:58 +08:00
parent 7089af45b6
commit 2a31a8676f
2 changed files with 41 additions and 0 deletions

28
jsonfail.cpp Normal file
View File

@ -0,0 +1,28 @@
#include "jsonfail.h"
const char* GetErrMsg(int errcode)
{
switch(errcode)
{
case err_need_login:
return "Please login first";
case err_method_not_supported:
return "Request Method not supported";
case err_missing_parameter:
return "Missing Parameter";
case err_config:
return "Failed to read configure";
case err_connect:
return "Failed to connect DB";
case err_sql:
return "Failed to execute SQL";
case err_sql_logic:
return "SQL Logical Error";
case err_permission_denied:
return "Permission denied";
case err_data:
return "Data Error";
default:
return "General error";
}
}

13
jsonfail.h Normal file
View File

@ -0,0 +1,13 @@
#pragma once
#define err_need_login 1
#define err_method_not_supported 2
#define err_missing_parameter 3
#define err_config 4
#define err_connect 5
#define err_sql 6
#define err_sql_logic 7
#define err_permission_denied 8
#define err_data 9
const char* GetErrMsg(int errcode);