-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexception.h
More file actions
31 lines (29 loc) · 943 Bytes
/
exception.h
File metadata and controls
31 lines (29 loc) · 943 Bytes
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
/*************************************************************************
> File Name: exception.h
> Author: MidCHeck
> Mail: midcheck@foxmail.com
> Created Time: 2019年06月20日 星期四 17时16分46秒
************************************************************************/
#ifndef MIDCHECK_EXCEPTION_H
#define MIDCHECK_EXCEPTION_H
#include<exception>
#include<string>
namespace MidCHeck{
#define mcthrow(x) throw MidCHeck::MCErr(x, __LINE__, __FILE__)
class MCErr: public std::exception{
private:
std::string msg;
const unsigned long line;
std::string file;
public:
const char* what() const throw(){
return msg.c_str();
}
explicit MCErr(const std::string& s, const unsigned long line, const char* file): msg("[-] MCError"), line(line), file(file){
msg += ", \"" + s + "\",";
msg += "\n -> file: " + this->file;
msg += " ----> " + std::to_string(this->line);
}
};
} // end namespace MidCHeck
#endif