@@ -88,29 +88,24 @@ def getConfig(config, section, configname, default_value=None, config_dic=None,
8888 else :
8989 pass
9090 if default_value is None :
91- raise e
91+ raise "读取{}参数异常,检查参数是否正常" . format ( configname )
9292 else :
9393 return default_value
9494
9595
96- def getBoolConfig (config , section , configname ):
96+ def getBoolConfig (config , section , configname , default_value = None , config_dic = None , JadeLog = None ):
9797 """
9898 读取ini参数,强制返回Bool
9999 :param string:
100100 :return:
101101 """
102- try :
103- configparam = (config .get (section , configname )).split ("#" )[0 ].rstrip ()
104- except :
105- print ("读取{}参数异常,请检查参数是否正常" .format (configname ))
106- sys .exit ()
102+ configparam = getConfig (config ,section ,configname ,default_value ,config_dic ,JadeLog )
107103 if configparam == "False" :
108104 return False
109105 elif configparam == "True" :
110106 return True
111107 else :
112- print ("读取{}参数异常,参数内容为:{}错误,请检查参数是否正常" .format (configname , configparam ))
113- sys .exit ()
108+ raise "参数:{}值不合法,请检查参数是否正常,参数值为{}" .format (configname ,configparam )
114109
115110
116111def getSectionsConfig (config , section_list , configname ):
@@ -120,12 +115,7 @@ def getSectionsConfig(config, section_list, configname):
120115 configparam = (config .get (section , configname )).split ("#" )[0 ].rstrip ()
121116 config_list .append (configparam )
122117 except Exception as e :
123- print ("读取{}参数异常,请检查参数是否正常,出错原因为 = {},发生异常文件{},发生异常所在的行数{}" .format (
124- configname .e ,
125- e .__traceback__ .tb_frame .f_globals [
126- "__file__" ],
127- e .__traceback__ .tb_lineno ))
128- sys .exit ()
118+ raise "读取{}参数异常,请检查参数是否正常" .format (configname )
129119 return config_list
130120
131121
@@ -144,8 +134,7 @@ def getSectionConfigs(config, section):
144134 for item in itemList :
145135 configsList .append (item [1 ].split ("#" )[0 ].rstrip ())
146136 except Exception as e :
147- print ("读取{}参数异常,请检查参数是否正常,异常原因为{}" .format (section , e ))
148- sys .exit ()
137+ raise "读取{}参数异常,请检查参数是否正常" .format (section )
149138 return configsList
150139
151140
0 commit comments