5 changed files with 175 additions and 13 deletions
-
94src/iflytop/components/iflytop_front_end_service/iflytop_front_end_service.cpp
-
13src/iflytop/components/iflytop_front_end_service/iflytop_front_end_service.hpp
-
6src/iflytop/core/core.hpp
-
32src/iflytop/core/error/error_code.cpp
-
43src/iflytop/core/error/error_code.hpp
@ -0,0 +1,6 @@ |
|||||
|
#pragma once
|
||||
|
|
||||
|
#include "iflytop/core/basic/nod/nod.hpp"
|
||||
|
#include "iflytop/core/components/timeutils.hpp"
|
||||
|
#include "iflytop/core/error/error_code.hpp"
|
||||
|
#include "iflytop/core/spdlogfactory/logger.hpp"
|
@ -0,0 +1,32 @@ |
|||||
|
#include "error_code.hpp"
|
||||
|
|
||||
|
namespace iflytop { |
||||
|
namespace err { |
||||
|
|
||||
|
using namespace std; |
||||
|
|
||||
|
// static set<error_code_desc_t> ecode_desc_set = {
|
||||
|
// {kcommon_error_code, kovertime, "overtime"},
|
||||
|
// {kcommon_error_code, kdevice_offline, "kdevice_offline"},
|
||||
|
// {kcommon_error_code, kpasswd_error, "kpasswd_error"},
|
||||
|
// };
|
||||
|
|
||||
|
static vector<error_code_desc_t> ecode_desc_set = { |
||||
|
{kcommon_error_code, kovertime, "overtime"}, |
||||
|
{kcommon_error_code, kdevice_offline, "kdevice_offline"}, |
||||
|
{kcommon_error_code, kpasswd_error, "kpasswd_error"}, |
||||
|
}; |
||||
|
|
||||
|
int32_t error_code_get_get_ecode(error_type_t error_type, int sub_error_code) { //
|
||||
|
return error_type * 1000 + sub_error_code; |
||||
|
} |
||||
|
string error_code_get_desc(error_type_t error_type, int sub_error_code, string extdes) { //
|
||||
|
for (auto& ecode_desc : ecode_desc_set) { |
||||
|
if (ecode_desc.error_type == error_type && ecode_desc.sub_error_code == sub_error_code) { |
||||
|
return fmt::format("{},{}", ecode_desc.desc, extdes); |
||||
|
} |
||||
|
} |
||||
|
return fmt::format("unkown_e({}-{}),{}", (int)error_type, sub_error_code, extdes); |
||||
|
} |
||||
|
} // namespace err
|
||||
|
} // namespace iflytop
|
@ -0,0 +1,43 @@ |
|||||
|
#pragma once
|
||||
|
#include <fstream>
|
||||
|
#include <functional>
|
||||
|
#include <iostream>
|
||||
|
#include <list>
|
||||
|
#include <map>
|
||||
|
#include <memory>
|
||||
|
#include <set>
|
||||
|
#include <sstream>
|
||||
|
#include <string>
|
||||
|
#include <vector>
|
||||
|
|
||||
|
#include "iflytop/core/basic/nod/nod.hpp"
|
||||
|
#include "iflytop/core/spdlogfactory/logger.hpp"
|
||||
|
namespace iflytop { |
||||
|
|
||||
|
namespace err { |
||||
|
using namespace std; |
||||
|
typedef enum { |
||||
|
kovertime = 1, |
||||
|
kdevice_offline = 2, |
||||
|
kpasswd_error = 3, |
||||
|
kparse_json_err = 4, |
||||
|
kcatch_exception = 5, |
||||
|
} common_error_code_t; |
||||
|
|
||||
|
typedef enum { |
||||
|
kcommon_error_code = 1, |
||||
|
} error_type_t; |
||||
|
|
||||
|
class error_code_desc_t { |
||||
|
public: |
||||
|
error_type_t error_type; |
||||
|
int sub_error_code; |
||||
|
string desc; |
||||
|
}; |
||||
|
|
||||
|
int32_t error_code_get_get_ecode(error_type_t error_type, int sub_error_code); |
||||
|
string error_code_get_desc(error_type_t error_type, int sub_error_code, string extdes); |
||||
|
|
||||
|
} // namespace err
|
||||
|
|
||||
|
} // namespace iflytop
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue