@@ -165,108 +165,102 @@ def _parse_config(self) -> None:
165165 # Value Error means the option exists but isn't a boolean.
166166 # Get as a string instead as it should then be a local path to a
167167 # CA bundle.
168- try :
169- self .ssl_verify = _config .get ("global" , "ssl_verify" )
170- except Exception : # pragma: no cover
171- pass
172- except Exception :
168+ self .ssl_verify = _config .get ("global" , "ssl_verify" )
169+ except (configparser .NoOptionError , configparser .NoSectionError ):
173170 pass
174171 try :
175172 self .ssl_verify = _config .getboolean (self .gitlab_id , "ssl_verify" )
176173 except ValueError :
177174 # Value Error means the option exists but isn't a boolean.
178175 # Get as a string instead as it should then be a local path to a
179176 # CA bundle.
180- try :
181- self .ssl_verify = _config .get (self .gitlab_id , "ssl_verify" )
182- except Exception : # pragma: no cover
183- pass
184- except Exception :
177+ self .ssl_verify = _config .get (self .gitlab_id , "ssl_verify" )
178+ except (configparser .NoOptionError , configparser .NoSectionError ):
185179 pass
186180
187181 try :
188182 self .timeout = _config .getint ("global" , "timeout" )
189- except Exception :
183+ except ( configparser . NoOptionError , configparser . NoSectionError ) :
190184 pass
191185 try :
192186 self .timeout = _config .getint (self .gitlab_id , "timeout" )
193- except Exception :
187+ except ( configparser . NoOptionError , configparser . NoSectionError ) :
194188 pass
195189
196190 try :
197191 self .private_token = _config .get (self .gitlab_id , "private_token" )
198- except Exception :
192+ except ( configparser . NoOptionError , configparser . NoSectionError ) :
199193 pass
200194
201195 try :
202196 self .oauth_token = _config .get (self .gitlab_id , "oauth_token" )
203- except Exception :
197+ except ( configparser . NoOptionError , configparser . NoSectionError ) :
204198 pass
205199
206200 try :
207201 self .job_token = _config .get (self .gitlab_id , "job_token" )
208- except Exception :
202+ except ( configparser . NoOptionError , configparser . NoSectionError ) :
209203 pass
210204
211205 try :
212206 self .http_username = _config .get (self .gitlab_id , "http_username" )
213207 self .http_password = _config .get (
214208 self .gitlab_id , "http_password"
215209 ) # pragma: no cover
216- except Exception :
210+ except ( configparser . NoOptionError , configparser . NoSectionError ) :
217211 pass
218212
219213 self ._get_values_from_helper ()
220214
221215 try :
222216 self .api_version = _config .get ("global" , "api_version" )
223- except Exception :
217+ except ( configparser . NoOptionError , configparser . NoSectionError ) :
224218 pass
225219 try :
226220 self .api_version = _config .get (self .gitlab_id , "api_version" )
227- except Exception :
221+ except ( configparser . NoOptionError , configparser . NoSectionError ) :
228222 pass
229223 if self .api_version not in ("4" ,):
230224 raise GitlabDataError (f"Unsupported API version: { self .api_version } " )
231225
232226 for section in ["global" , self .gitlab_id ]:
233227 try :
234228 self .per_page = _config .getint (section , "per_page" )
235- except Exception :
229+ except ( configparser . NoOptionError , configparser . NoSectionError ) :
236230 pass
237231 if self .per_page is not None and not 0 <= self .per_page <= 100 :
238232 raise GitlabDataError (f"Unsupported per_page number: { self .per_page } " )
239233
240234 try :
241235 self .pagination = _config .get (self .gitlab_id , "pagination" )
242- except Exception :
236+ except ( configparser . NoOptionError , configparser . NoSectionError ) :
243237 pass
244238
245239 try :
246240 self .order_by = _config .get (self .gitlab_id , "order_by" )
247- except Exception :
241+ except ( configparser . NoOptionError , configparser . NoSectionError ) :
248242 pass
249243
250244 try :
251245 self .user_agent = _config .get ("global" , "user_agent" )
252- except Exception :
246+ except ( configparser . NoOptionError , configparser . NoSectionError ) :
253247 pass
254248 try :
255249 self .user_agent = _config .get (self .gitlab_id , "user_agent" )
256- except Exception :
250+ except ( configparser . NoOptionError , configparser . NoSectionError ) :
257251 pass
258252
259253 try :
260254 self .retry_transient_errors = _config .getboolean (
261255 "global" , "retry_transient_errors"
262256 )
263- except Exception :
257+ except ( configparser . NoOptionError , configparser . NoSectionError ) :
264258 pass
265259 try :
266260 self .retry_transient_errors = _config .getboolean (
267261 self .gitlab_id , "retry_transient_errors"
268262 )
269- except Exception :
263+ except ( configparser . NoOptionError , configparser . NoSectionError ) :
270264 pass
271265
272266 def _get_values_from_helper (self ) -> None :
0 commit comments