forked from kerlomz/captcha_trainer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
exception.py
36 lines (27 loc) · 797 Bytes
/
exception.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
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# Author: kerlomz <kerlomz@gmail.com>
import sys
import time
class SystemException(RuntimeError):
def __init__(self, message, code=-1):
self.message = message
self.code = code
class Error(object):
def __init__(self, message, code=-1):
self.message = message
self.code = code
print(self.message)
time.sleep(5)
sys.exit(self.code)
def exception(text, code=-1):
# raise SystemException(text, code)
Error(text, code)
class ConfigException:
SYS_CONFIG_PATH_NOT_EXIST = -4041
MODEL_CONFIG_PATH_NOT_EXIST = -4042
CHAR_SET_NOT_EXIST = -4043
CHAR_SET_INCORRECT = -4043
SAMPLE_LABEL_ERROR = -4044
GET_LABEL_REGEX_ERROR = -4045
INSUFFICIENT_SAMPLE = -5