Improving error line reporting
This commit is contained in:
parent
640fd7b0d1
commit
8979ac0cc8
|
@ -281,9 +281,7 @@ function bhl_handle_error_result(array $ret_out, $err_file, $exit = true)
|
||||||
}
|
}
|
||||||
$file = $jerr->file;
|
$file = $jerr->file;
|
||||||
|
|
||||||
stderr("BHL ERROR: \n" .
|
stderr("BHL ERROR: \n" . $jerr->error . " \nin '$file', line {$jerr->line}\n");
|
||||||
$jerr->error .
|
|
||||||
" \nin '$file', line {$jerr->line}\n");
|
|
||||||
stderr(bhl_show_position($jerr->line, $jerr->column, file($file)) . "\n");
|
stderr(bhl_show_position($jerr->line, $jerr->column, file($file)) . "\n");
|
||||||
if($exit)
|
if($exit)
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -361,7 +359,7 @@ function bhl_clean_cache()
|
||||||
|
|
||||||
function bhl_show_position($line, $row, array $lines)
|
function bhl_show_position($line, $row, array $lines)
|
||||||
{
|
{
|
||||||
if($line < count($lines))
|
if($line > 0 && $line < count($lines))
|
||||||
{
|
{
|
||||||
$txt = $lines[$line-1];
|
$txt = $lines[$line-1];
|
||||||
$c = str_repeat('-', $row);
|
$c = str_repeat('-', $row);
|
||||||
|
|
Loading…
Reference in New Issue