Skip to content

Commit d6a576a

Browse files
committed
More information about thrown exception in child process
1 parent 02988ca commit d6a576a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Command/WorkerCommand.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,13 @@ private function runWorker(
200200
} catch (Throwable $t) {
201201
$this->errorCount++;
202202
$internalErrorsCount++;
203-
$internalErrorMessage = sprintf('Internal error: %s in file %s', $t->getMessage(), $file);
203+
$internalErrorMessage = sprintf('Internal error: %s while analysing file %s', $t->getMessage(), $file);
204204

205205
$bugReportUrl = 'https://github.com/phpstan/phpstan/issues/new?template=Bug_report.yaml';
206206
if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
207-
$internalErrorMessage .= sprintf('%sPost the following stack trace to %s: %s%s', "\n\n", $bugReportUrl, "\n", $t->getTraceAsString());
207+
$trace = sprintf('## %s(%d)%s', $t->getFile(), $t->getLine(), "\n");
208+
$trace .= $t->getTraceAsString();
209+
$internalErrorMessage .= sprintf('%sPost the following stack trace to %s: %s%s', "\n\n", $bugReportUrl, "\n", $trace);
208210
} else {
209211
$internalErrorMessage .= sprintf('%sRun PHPStan with -v option and post the stack trace to:%s%s', "\n", "\n", $bugReportUrl);
210212
}

0 commit comments

Comments
 (0)