summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/luacov/reporter.lua11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/luacov/reporter.lua b/src/luacov/reporter.lua
index 3d514b7..e1da371 100644
--- a/src/luacov/reporter.lua
+++ b/src/luacov/reporter.lua
@@ -440,10 +440,12 @@ function ReporterBase:run()
for _, filename in ipairs(self:files()) do
local file = io.open(filename, "r")
- local file_hits, file_miss = 0, 0
- local ok, err
- if file then ok, err = pcall(function() -- try
+
+ if not file then
+ print("Could not open file " .. filename)
+ else
self:on_new_file(filename)
+ local file_hits, file_miss = 0, 0
local filedata = self:stats(filename)
local line_nr = 1
@@ -468,9 +470,8 @@ function ReporterBase:run()
line_nr = line_nr + 1
end
- end) -- finally
+
file:close()
- assert(ok, err)
self:on_end_file(filename, file_hits, file_miss)
end
end