forked from ChunelFeng/CGraph
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCException.h
More file actions
46 lines (37 loc) · 1.01 KB
/
CException.h
File metadata and controls
46 lines (37 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/***************************
@Author: Chunel
@Contact: chunel@foxmail.com
@File: CException.h
@Time: 2022/4/15 20:51
@Desc: 异常处理类
***************************/
#ifndef CGRAPH_CEXCEPTION_H
#define CGRAPH_CEXCEPTION_H
#include <string>
#include <exception>
#include "CStrDefine.h"
CGRAPH_NAMESPACE_BEGIN
CGRAPH_INTERNAL_NAMESPACE_BEGIN
class CEXCEPTION : public std::exception {
public:
explicit CEXCEPTION(const std::string& info,
const std::string& locate = CGRAPH_EMPTY) {
/**
* 这里的设计,和CStatus有一个联动
* 如果不了解具体情况,不建议做任何修改
*/
exception_info_ = locate + " | " + info;
}
/**
* 获取异常信息
* @return
*/
const char* what() const noexcept override {
return exception_info_.c_str();
}
private:
std::string exception_info_; // 异常状态信息
};
CGRAPH_INTERNAL_NAMESPACE_END
CGRAPH_NAMESPACE_END
#endif //CGRAPH_CEXCEPTION_H