88require 'zlib'
99
1010class SimpleCov ::Formatter ::Codecov
11- VERSION = '0.2.1 '
11+ VERSION = '0.2.2 '
1212
1313 ### CIs
1414 RECOGNIZED_CIS = [
@@ -280,20 +280,21 @@ def retry_request(req, https)
280280 retries = 3
281281 begin
282282 response = https . request ( req )
283- rescue Timeout ::Error => e
283+ rescue Timeout ::Error , SocketError => e
284284 retries -= 1
285285
286286 if retries . zero?
287- puts 'Timeout error uploading coverage reports to Codecov. Out of retries.'
287+ puts 'Timeout or connection error uploading coverage reports to Codecov. Out of retries.'
288288 puts e
289289 return response
290290 end
291291
292- puts 'Timeout error uploading coverage reports to Codecov. Retrying...'
292+ puts 'Timeout or connection error uploading coverage reports to Codecov. Retrying...'
293293 puts e
294294 retry
295295 rescue StandardError => e
296296 puts 'Error uploading coverage reports to Codecov. Sorry'
297+ puts e . class . name
297298 puts e
298299 return response
299300 end
@@ -362,8 +363,8 @@ def upload_to_v4(url, report, query, query_without_token)
362363 }
363364 )
364365 response = retry_request ( req , https )
365- if response . code == '400'
366- puts response . body . red
366+ if ! response &. code || response . code == '400'
367+ puts response & .body & .red
367368 return false
368369 end
369370
@@ -429,8 +430,8 @@ def handle_report_response(report)
429430 end
430431 end
431432
432- def format ( result )
433- net_blockers ( :off )
433+ def format ( result , disable_net_blockers = true )
434+ net_blockers ( :off ) if disable_net_blockers
434435
435436 display_header
436437 ci = detect_ci
@@ -443,7 +444,8 @@ def format(result)
443444
444445 report [ 'result' ] = JSON . parse ( response )
445446 handle_report_response ( report )
446- net_blockers ( :on )
447+
448+ net_blockers ( :on ) if disable_net_blockers
447449 report
448450 end
449451
0 commit comments