Skip to content

Commit

Permalink
CloverXMLGenerator: reports file name is case of parse error
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed May 4, 2022
1 parent 86f49e2 commit fd9d510
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/CodeCoverage/Generators/CloverXMLGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,11 @@ protected function renderSelf(): void
$elFile->setAttribute('name', $file);
$elFileMetrics = $elFile->appendChild($doc->createElement('metrics'));

$code = $parser->parse(file_get_contents($file));
try {
$code = $parser->parse(file_get_contents($file));
} catch (\ParseError $e) {
throw new \ParseError($e->getMessage() . ' in file ' . $file);
}

$fileMetrics = (object) [
'linesOfCode' => $code->linesOfCode,
Expand Down

0 comments on commit fd9d510

Please sign in to comment.