For now showing only the first error per file

This commit is contained in:
Pavel Shevaev 2023-03-02 19:52:11 +03:00
parent 8839cf79b9
commit 91d9ad0946
1 changed files with 7 additions and 2 deletions

View File

@ -271,18 +271,23 @@ function bhl_handle_error_result(array $ret_out, $err_file, $exit = true)
exit(1);
}
$history = array();
$err_lines = file($err_file);
foreach($err_lines as $err)
{
$jerr = json_decode($err);
if(!$jerr)
{
stderr("Something went wrong, bhl error is in invalid format: $err");
stderr("Something went wrong, bhl error is in invalid format: $err\n");
continue;
}
$file = $jerr->file;
stderr("BHL ERROR: \n" . $jerr->error . " \nin '$file', line {$jerr->line}\n");
//let's show only one error per file
if(isset($history[$file]))
continue;
$history[$file] = true;
stderr("BHL ERROR: " . $jerr->error . " \nin '$file', line {$jerr->line}\n");
if(file_exists($file))
stderr(bhl_show_position($jerr->line, $jerr->column, file($file)) . "\n");
}