Browse Source

自定义异常

dongzhaorui 3 năm trước cách đây
mục cha
commit
8953a9812b
1 tập tin đã thay đổi với 19 bổ sung0 xóa
  1. 19 0
      find_source/common/execptions.py

+ 19 - 0
find_source/common/execptions.py

@@ -0,0 +1,19 @@
+
+class JyException(Exception):
+
+    def __init__(self, code: int, reason: str, **kwargs):
+        self.code = code
+        self.reason = reason
+        self.err_details = kwargs
+        for key, val in kwargs.items():
+            setattr(self, key, val)
+
+
+class VerifyException(JyException):
+
+    def __init__(self, code: int = 10001, reason: str = '特征检验错误', **kwargs):
+        self.code = code
+        self.reason = reason
+        self.err_details = kwargs
+        for key, val in kwargs.items():
+            setattr(self, key, val)