@@ -72,8 +72,7 @@ def get_settings(self) -> Settings:
7272 }
7373
7474 except KeyError as e :
75- log .error ("Git info not available, cannot fetch settings" )
76- log .debug ("Git info not available, cannot fetch settings (missing key: %s)" , e )
75+ log .error ("Git info not available, cannot fetch settings (missing key: %s)" , e )
7776 telemetry .record_error (ErrorType .UNKNOWN )
7877 return Settings ()
7978
@@ -83,9 +82,8 @@ def get_settings(self) -> Settings:
8382 )
8483 result .on_error_raise_exception ()
8584
86- except Exception :
87- log .error ("Error getting settings from API" )
88- log .debug ("Error getting settings from API" , exc_info = True )
85+ except Exception as e :
86+ log .error ("Error getting settings from API: %s" , e )
8987 return Settings ()
9088
9189 try :
@@ -123,18 +121,16 @@ def get_known_tests(self) -> t.Set[TestRef]:
123121 }
124122
125123 except KeyError as e :
126- log .error ("Git info not available, cannot fetch known tests" )
127- log .debug ("Git info not available, cannot fetch known tests (missing key: %s)" , e )
124+ log .error ("Git info not available, cannot fetch known tests (missing key: %s)" , e )
128125 telemetry .record_error (ErrorType .UNKNOWN )
129126 return set ()
130127
131128 try :
132129 result = self .connector .post_json ("/api/v2/ci/libraries/tests" , request_data , telemetry = telemetry )
133130 result .on_error_raise_exception ()
134131
135- except Exception :
136- log .error ("Error getting known tests from API" )
137- log .debug ("Error getting known tests from API" , exc_info = True )
132+ except Exception as e :
133+ log .exception ("Error getting known tests from API: %s" , e )
138134 return set ()
139135
140136 try :
@@ -149,8 +145,7 @@ def get_known_tests(self) -> t.Set[TestRef]:
149145 known_test_ids .add (TestRef (suite_ref , test ))
150146
151147 except Exception :
152- log .error ("Error getting known tests from API" )
153- log .debug ("Error getting known tests from API" , exc_info = True )
148+ log .exception ("Error getting known tests from API" )
154149 telemetry .record_error (ErrorType .BAD_JSON )
155150 return set ()
156151
@@ -179,11 +174,7 @@ def get_test_management_properties(self) -> t.Dict[TestRef, TestProperties]:
179174 }
180175
181176 except KeyError as e :
182- log .error ("Git info not available, cannot fetch Test Management properties" )
183- log .debug (
184- "Git info not available, cannot fetch Test Management properties (missing key: %s)" ,
185- e ,
186- )
177+ log .error ("Git info not available, cannot fetch Test Management properties (missing key: %s)" , e )
187178 telemetry .record_error (ErrorType .UNKNOWN )
188179 return {}
189180
@@ -193,9 +184,8 @@ def get_test_management_properties(self) -> t.Dict[TestRef, TestProperties]:
193184 )
194185 result .on_error_raise_exception ()
195186
196- except Exception :
197- log .error ("Error getting Test Management properties from API" )
198- log .debug ("Error getting Test Management properties from API" , exc_info = True )
187+ except Exception as e :
188+ log .error ("Error getting Test Management properties from API: %s" , e )
199189 return {}
200190
201191 try :
@@ -218,8 +208,7 @@ def get_test_management_properties(self) -> t.Dict[TestRef, TestProperties]:
218208 )
219209
220210 except Exception :
221- log .error ("Failed to parse Test Management tests data from API" )
222- log .debug ("Failed to parse Test Management tests data from API" , exc_info = True )
211+ log .exception ("Failed to parse Test Management tests data from API" )
223212 telemetry .record_error (ErrorType .BAD_JSON )
224213 return {}
225214
@@ -243,8 +232,7 @@ def get_known_commits(self, latest_commits: t.List[str]) -> t.List[str]:
243232 }
244233
245234 except KeyError as e :
246- log .error ("Git info not available, cannot fetch known commits" )
247- log .debug ("Git info not available, cannot fetch known commits (missing key: %s)" , e )
235+ log .error ("Git info not available, cannot fetch known commits (missing key: %s)" , e )
248236 telemetry .record_error (ErrorType .UNKNOWN )
249237 return []
250238
@@ -262,8 +250,7 @@ def get_known_commits(self, latest_commits: t.List[str]) -> t.List[str]:
262250 known_commits = [item ["id" ] for item in result .parsed_response ["data" ] if item ["type" ] == "commit" ]
263251
264252 except Exception :
265- log .error ("Failed to parse search_commits data" )
266- log .debug ("Failed to parse search_commits data" , exc_info = True )
253+ log .exception ("Failed to parse search_commits data" )
267254 telemetry .record_error (ErrorType .BAD_JSON )
268255 return []
269256
@@ -284,8 +271,7 @@ def send_git_pack_file(self, packfile: Path) -> t.Optional[int]:
284271 }
285272
286273 except KeyError as e :
287- log .error ("Git info not available, cannot send git packfile" )
288- log .debug ("Git info not available, cannot send git packfile (missing key: %s)" , e )
274+ log .error ("Git info not available, cannot send git packfile (missing key: %s)" , e )
289275 telemetry .record_error (ErrorType .UNKNOWN )
290276 return None
291277
@@ -305,8 +291,7 @@ def send_git_pack_file(self, packfile: Path) -> t.Optional[int]:
305291 ]
306292
307293 except Exception :
308- log .error ("Error sending Git pack data" )
309- log .debug ("Error sending Git pack data" , exc_info = True )
294+ log .exception ("Error sending Git pack data" )
310295 telemetry .record_error (ErrorType .UNKNOWN )
311296 return None
312297
@@ -318,7 +303,6 @@ def send_git_pack_file(self, packfile: Path) -> t.Optional[int]:
318303
319304 except Exception :
320305 log .warning ("Failed to upload Git pack data" )
321- log .debug ("Failed to upload Git pack data" , exc_info = True )
322306 return None
323307
324308 return len (content )
@@ -348,18 +332,16 @@ def get_skippable_tests(self) -> t.Tuple[t.Set[t.Union[SuiteRef, TestRef]], t.Op
348332 }
349333
350334 except KeyError as e :
351- log .error ("Git info not available, cannot get skippable items" )
352- log .debug ("Git info not available, cannot get skippable items (missing key: %s)" , e )
335+ log .error ("Git info not available, cannot get skippable items (missing key: %s)" , e )
353336 telemetry .record_error (ErrorType .UNKNOWN )
354337 return set (), None
355338
356339 try :
357340 result = self .connector .post_json ("/api/v2/ci/tests/skippable" , request_data , telemetry = telemetry )
358341 result .on_error_raise_exception ()
359342
360- except Exception :
361- log .error ("Error getting skippable tests from API" )
362- log .debug ("Error getting skippable tests from API" , exc_info = True )
343+ except Exception as e :
344+ log .error ("Error getting skippable tests from API: %s" , e )
363345 return set (), None
364346
365347 try :
@@ -378,8 +360,7 @@ def get_skippable_tests(self) -> t.Tuple[t.Set[t.Union[SuiteRef, TestRef]], t.Op
378360 correlation_id = result .parsed_response ["meta" ]["correlation_id" ]
379361
380362 except Exception :
381- log .error ("Failed to parse skippable tests data from API" )
382- log .debug ("Failed to parse skippable tests data from API" , exc_info = True )
363+ log .exception ("Failed to parse skippable tests data from API" )
383364 telemetry .record_error (ErrorType .BAD_JSON )
384365 return set (), None
385366
0 commit comments