-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherr_codes.py
58 lines (47 loc) · 1.31 KB
/
err_codes.py
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
55
56
57
58
# -*- encoding: utf-8 -*-
""" 响应错误码 """
from dataclasses import dataclass
class SevenThirtyException(Exception):
""" 基础错误类 """
def __init__(self, code, message) -> None:
super().__init__(self)
self.code = code
self.message = message
def __str__(self):
return "[{}] {}".format(str(self.code), self.message)
@dataclass
class ErrorCodes():
""" 错误码及错误信息映射 """
CONN_POOL_INIT_FAIL = {
"code": 5001,
"message": "mysql connection pool init fail"
}
REDIS_CONNECTION_FAIL = {
"code": 5002,
"message": "redis connection or auth fail"
}
GET_LATEST_TIME_POINTER_FAIL = {
"code": 5003,
"message": "get latest time pointer from redis failed"
}
GET_LATEST_HUMI_OR_TEMP_FAIL = {
"code": 5004,
"message": "get latest humidity or tempature failed"
}
INVALID_TOKEN = {
"code": 7001,
"message": "invalid token"
}
WX_INVALID_CODE = {
"code": 10001,
"message": "invalid code"
}
WX_REGISTER_FAIL = {
"code": 10002,
"message": "can not get openid with code"
}
WX_INVALID_ENCRYPTED_DATA = {
"code": 10003,
"message": "invalid encrypted data"
}
error_codes = ErrorCodes()