aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2021-01-08 08:22:50 +0100
committerGitHub <noreply@github.com>2021-01-08 08:22:50 +0100
commit645e3e6d7e89edb9ea2e56b7438fe5b4e4ea0e8d (patch)
tree59837e763ab12b7b736ca22ba6e1e5b249f743b3 /core
parent5bb75c4f238033c9869029f1f8950b585c95588f (diff)
parentd0ac76a77c820d065f7b4af5238e5d11ec66253b (diff)
downloadnextcloud-server-645e3e6d7e89edb9ea2e56b7438fe5b4e4ea0e8d.tar.gz
nextcloud-server-645e3e6d7e89edb9ea2e56b7438fe5b4e4ea0e8d.zip
Merge pull request #25021 from nextcloud/enhancement/occ-install-exception-trace
Print an exception trace for setup exceptions
Diffstat (limited to 'core')
-rw-r--r--core/Command/Maintenance/Install.php23
1 files changed, 20 insertions, 3 deletions
diff --git a/core/Command/Maintenance/Install.php b/core/Command/Maintenance/Install.php
index dffbbd03382..fc219e79bcd 100644
--- a/core/Command/Maintenance/Install.php
+++ b/core/Command/Maintenance/Install.php
@@ -43,6 +43,8 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\Question;
+use Throwable;
+use function get_class;
class Install extends Command {
@@ -201,11 +203,26 @@ class Install extends Command {
protected function printErrors(OutputInterface $output, $errors) {
foreach ($errors as $error) {
if (is_array($error)) {
- $output->writeln('<error>' . (string)$error['error'] . '</error>');
- $output->writeln('<info> -> ' . (string)$error['hint'] . '</info>');
+ $output->writeln('<error>' . $error['error'] . '</error>');
+ if (isset($error['hint']) && !empty($error['hint'])) {
+ $output->writeln('<info> -> ' . $error['hint'] . '</info>');
+ }
+ if (isset($error['exception']) && $error['exception'] instanceof Throwable) {
+ $this->printThrowable($output, $error['exception']);
+ }
} else {
- $output->writeln('<error>' . (string)$error . '</error>');
+ $output->writeln('<error>' . $error . '</error>');
}
}
}
+
+ private function printThrowable(OutputInterface $output, Throwable $t): void {
+ $output->write('<info>Trace: ' . $t->getTraceAsString() . '</info>');
+ $output->writeln('');
+ if ($t->getPrevious() !== null) {
+ $output->writeln('');
+ $output->writeln('<info>Previous: ' . get_class($t->getPrevious()) . ': ' . $t->getPrevious()->getMessage() . '</info>');
+ $this->printThrowable($output, $t->getPrevious());
+ }
+ }
}