Skip to content

Commit

Permalink
Added a little bit of error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh Holtz committed Sep 17, 2019
1 parent 8b15f06 commit 573aee2
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions lib/xcov/manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ def parse_xccoverage
if xccoverage_files.empty?
xcresult_paths = Dir["#{test_logs_path}*.xcresult"].sort_by { |filename| File.mtime(filename) }.reverse
xcresult_paths.each do |xcresult_path|
parser = XCResult::Parser.new(path: xcresult_path)
xccoverage_files += parser.export_xccovreports(destination: Dir.mktmpdir)
xccoverage_files += export_paths_from_xcresult!(xcresult_path)
end
end

Expand Down Expand Up @@ -174,12 +173,20 @@ def xccov_file_direct_paths

path = Xcov.config[:xccov_file_direct_path]
if File.extname(path) == '.xcresult'
parser = XCResult::Parser.new(path: path)
return parser.export_xccovreports(destination: Dir.mktmpdir)
return export_paths_from_xcresult!(path)
end

return [Pathname.new(path).to_s]
end

def export_paths_from_xcresult!(path)
parser = XCResult::Parser.new(path: path)
return parser.export_xccovreports(destination: Dir.mktmpdir)
rescue
UI.error("Error occured while exporting xccovreport from xcresult '#{path}'")
UI.error("Make sure you have both Xcode 11 selected and pointing to the correct xcresult file")
UI.crash!("Failed to export xccovreport from xcresult'")
end

end
end

0 comments on commit 573aee2

Please sign in to comment.