-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathError.py
More file actions
32 lines (23 loc) · 897 Bytes
/
Error.py
File metadata and controls
32 lines (23 loc) · 897 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
32
# -*- coding: utf-8 -*-
from Constant import *
import json
class HmError(Exception):
def __init__(self, code=0, message=''):
self.code = code
self.message = message
def __str__(self):
return "代码:%d 信息:%s" % (self.code, self.message)
class OperateException(Exception):
def __init__(self, message=''):
self.message = message
def __str__(self):
return "操作错误:" + self.message
def __repr__(self):
return "操作错误:" + self.message
def error_find(data):
if 'eid' in data:
if int(data['eid']) in init_data.error_code:
raise HmError(code=data['eid'],
message="错误代码:" + str(data['eid']) + " " + init_data.error_code[int(data['eid'])])
else:
raise HmError(code=data['eid'], message="未知错误:%d 请等待修复" % data["eid"])