Skip to content

Commit fd9d510

Browse files
committed
CloverXMLGenerator: reports file name is case of parse error
1 parent 86f49e2 commit fd9d510

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/CodeCoverage/Generators/CloverXMLGenerator.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,11 @@ protected function renderSelf(): void
9292
$elFile->setAttribute('name', $file);
9393
$elFileMetrics = $elFile->appendChild($doc->createElement('metrics'));
9494

95-
$code = $parser->parse(file_get_contents($file));
95+
try {
96+
$code = $parser->parse(file_get_contents($file));
97+
} catch (\ParseError $e) {
98+
throw new \ParseError($e->getMessage() . ' in file ' . $file);
99+
}
96100

97101
$fileMetrics = (object) [
98102
'linesOfCode' => $code->linesOfCode,

0 commit comments

Comments
 (0)