diff --git a/CHANGELOG.md b/CHANGELOG.md index 75f5e33..089049f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +### `0.4.2` +- #134 Wrap file creation in try/catch + ### `0.4.1` - #133 Write down to file when using the formatter diff --git a/lib/codecov/formatter.rb b/lib/codecov/formatter.rb index 25689ed..c4c5c0b 100644 --- a/lib/codecov/formatter.rb +++ b/lib/codecov/formatter.rb @@ -17,12 +17,13 @@ def format(report) } result.update(result_to_codecov(report)) - result_path = File.join(::SimpleCov.coverage_path, RESULT_FILE_NAME) - if File.writable?(result_path) + begin + result_path = File.join(::SimpleCov.coverage_path, RESULT_FILE_NAME) File.write(result_path, result['codecov']) - puts "Coverage report generated to #{result_path}.\#{result}" - else - puts "Could not write coverage report to file #{result_path}.\n#{result}" + puts "Coverage report generated to #{result_path}.\n#{result}" + rescue Errno::ENOENT => e + puts e + puts "Could not write coverage report to file.\n#{result}" end result diff --git a/lib/codecov/version.rb b/lib/codecov/version.rb index 63acaac..f9f0fb2 100644 --- a/lib/codecov/version.rb +++ b/lib/codecov/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Codecov - VERSION = '0.4.1' + VERSION = '0.4.2' end