瀏覽代碼

自定义异常

dongzhaorui 3 年之前
父節點
當前提交
8953a9812b
共有 1 個文件被更改,包括 19 次插入0 次删除
  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)