@@ -18,7 +18,11 @@ def default_postman_constructor(session, **kwargs):
1818
1919
2020def default_raise_regex_error (msg , * _args , ** _kwargs ):
21- raise AssertionError (msg )
21+ raise JmModuleConfig .exception (msg )
22+
23+
24+ class JmcomicException (Exception ):
25+ pass
2226
2327
2428class JmModuleConfig :
@@ -60,7 +64,9 @@ class JmModuleConfig:
6064 CLASS_OPTION = None
6165 CLASS_ALBUM = None
6266 CLASS_PHOTO = None
67+ CLASS_IMAGE = None
6368 CLASS_CLIENT_IMPL = {}
69+ CLASS_EXCEPTION = None
6470
6571 # 执行debug的函数
6672 debug_executor = default_jm_debug
@@ -104,6 +110,14 @@ def photo_class(cls):
104110 from .jm_entity import JmPhotoDetail
105111 return JmPhotoDetail
106112
113+ @classmethod
114+ def image_class (cls ):
115+ if cls .CLASS_IMAGE is not None :
116+ return cls .CLASS_IMAGE
117+
118+ from .jm_entity import JmImageDetail
119+ return JmImageDetail
120+
107121 @classmethod
108122 def client_impl_class (cls , client_key : str ):
109123 client_impl_dict = cls .CLASS_CLIENT_IMPL
@@ -114,6 +128,13 @@ def client_impl_class(cls, client_key: str):
114128
115129 return impl_class
116130
131+ @classmethod
132+ def exception (cls , msg : str ):
133+ if cls .CLASS_EXCEPTION is not None :
134+ return cls .CLASS_EXCEPTION (msg )
135+
136+ return JmcomicException (msg )
137+
117138 @classmethod
118139 @field_cache ("DOMAIN" )
119140 def domain (cls , postman = None ):
@@ -185,7 +206,7 @@ def get_jmcomic_domain_all(cls, postman=None):
185206
186207 resp = postman .get (cls .JM_PUB_URL )
187208 if resp .status_code != 200 :
188- raise AssertionError (resp .text )
209+ raise JmModuleConfig . exception (resp .text )
189210
190211 from .jm_toolkit import JmcomicText
191212 domain_list = JmcomicText .analyse_jm_pub_html (resp .text )
0 commit comments