-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy patherror_code.py
More file actions
99 lines (93 loc) · 3.07 KB
/
Copy patherror_code.py
File metadata and controls
99 lines (93 loc) · 3.07 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# -*- coding: utf-8 -*-
"""
The class hierarchy for built-in exceptions is:
see https://docs.python.org/3/library/exceptions.html
BaseException
├── SystemExit
├── KeyboardInterrupt
├── GeneratorExit
└── Exception
├── ArithmeticError
│ ├── FloatingPointError
│ ├── OverflowError
│ └── ZeroDivisionError
├── AssertionError
├── AttributeError
├── BufferError
├── EOFError
├── ImportError
│ └── ModuleNotFoundError
├── LookupError
│ ├── IndexError
│ └── KeyError
├── MemoryError
├── NameError
│ └── UnboundLocalError
├── OSError
│ ├── BlockingIOError
│ ├── ChildProcessError
│ ├── ConnectionError
│ │ ├── BrokenPipeError
│ │ ├── ConnectionAbortedError
│ │ ├── ConnectionRefusedError
│ │ └── ConnectionResetError
│ ├── FileExistsError
│ ├── FileNotFoundError
│ ├── InterruptedError
│ ├── IsADirectoryError
│ ├── NotADirectoryError
│ ├── PermissionError
│ ├── ProcessLookupError
│ └── TimeoutError
├── ReferenceError
├── RuntimeError
│ ├── NotImplementedError
│ └── RecursionError
├── SyntaxError
│ └── IndentationError
│ └── TabError
├── SystemError
├── TypeError
├── ValueError
│ └── UnicodeError
│ ├── DecodeError
│ ├── EncodeError
│ └── UnicodeTranslateError
└── Warning
├── DeprecationWarning
├── PendingDeprecationWarning
├── RuntimeWarning
├── SyntaxWarning
├── UserWarning
├── FutureWarning
├── ImportWarning
└── UnicodeWarning
"""
from enum import Enum
ERROR_CODE_TABLE = {
ImportError: "ops.0001",
ModuleNotFoundError: "ops.0002",
NameError: "ops.0003",
KeyError: "ops.0004",
IndexError: "ops.0005",
ValueError: "ops.0006",
TypeError: "ops.0007",
SyntaxError: "ops.0008",
AttributeError: "ops.0009",
ArithmeticError: "ops.0010",
MemoryError: "ops.0011",
OSError: "ops.0012",
FileNotFoundError: "ops.0013",
NotADirectoryError: "ops.0014",
PermissionError: "ops.0015",
TimeoutError: "ops.0016",
}
UNKNOWN_ERROR_CODE = "ops.9999"
class ErrorCode(Enum):
# 通用错误
SUCCESS = (0, "Success")
UNKNOWN_ERROR = (1, "Unknown error")
PARAM_ERROR = (2, "Invalid parameter")
FILE_NOT_FOUND_ERROR = (1000, "File not found!")
SUBMIT_TASK_ERROR = (1001, "Task submitted Failed!")
CANCEL_TASK_ERROR = (1002, "Task canceled Failed!")