-
Notifications
You must be signed in to change notification settings - Fork 0
/
Error.hpp
54 lines (50 loc) · 1.32 KB
/
Error.hpp
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
47
48
49
50
51
52
53
54
//
// Created by JerryGuo on 2021/12/19.
//
#ifndef UNTITLED1_ERROR_HPP
#define UNTITLED1_ERROR_HPP
//class BasicException : public std::exception {
// const char *message;
// BasicException(const char *message_):message(message_){};
// const char *what() { return message; }
//};
//
//// 格式错误
//class SyntaxError : public BasicException {
//
//};
//
//
//// 密码错误
//class IncorrectPassword : public BasicException {
//
//};
//// 用户名已存在
//class DuplicateUsername : public BasicException {};
//// 用户名不存在
//class UserNotExist : public BasicException {};
//// 权限错误
//class PermissionError : public BasicException {};
//
//
//// 没有匹配的图书
//class NoBookMatched : public BasicException {};
//// 未选择图书
//class NoBookSelected : public BasicException {};
//
//
//// 超过历史交易总笔数
//class EntryNumExceeded : public BasicException {};
#include <ostream>
class Error: public std::exception{
const string message;
public:
Error()=default;
Error(const string &error_disc):message(error_disc){};
Error(const Error &x):message(x.message){};
friend std::ostream &operator<<(std::ostream &os, const Error &error) {
os << "message: " << error.message;
return os;
}
};
#endif //UNTITLED1_ERROR_HPP