Skip to content

Commit

Permalink
More information about thrown exception in child process
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Oct 6, 2023
1 parent 02988ca commit d6a576a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Command/WorkerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,13 @@ private function runWorker(
} catch (Throwable $t) {
$this->errorCount++;
$internalErrorsCount++;
$internalErrorMessage = sprintf('Internal error: %s in file %s', $t->getMessage(), $file);
$internalErrorMessage = sprintf('Internal error: %s while analysing file %s', $t->getMessage(), $file);

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

0 comments on commit d6a576a

Please sign in to comment.