From e5fc20991be1f73f37347db05592023a8b72aba8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Mon, 20 Feb 2023 16:31:23 +0100 Subject: [PATCH] Improve verbose output when an exception happens MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Show the whole trace, not only the trace of the wrapper exception. Signed-off-by: Côme Chilliet --- lib/Command/Export.php | 5 +++-- lib/Command/Import.php | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/Command/Export.php b/lib/Command/Export.php index 55458d65..9777b6b7 100644 --- a/lib/Command/Export.php +++ b/lib/Command/Export.php @@ -212,9 +212,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int $io->writeln("Export saved in $folder/$exportName.zip"); } catch (\Exception $e) { if ($io->isDebug()) { - $io->error($e->getTraceAsString()); + $io->error("$e"); + } else { + $io->error($e->getMessage()); } - $io->error($e->getMessage()); return $e->getCode() !== 0 ? (int)$e->getCode() : 1; } diff --git a/lib/Command/Import.php b/lib/Command/Import.php index cf35f123..af145031 100644 --- a/lib/Command/Import.php +++ b/lib/Command/Import.php @@ -94,9 +94,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int $io->writeln("Successfully imported from ${path}"); } catch (\Exception $e) { if ($io->isDebug()) { - $io->error($e->getTrace()); + $io->error("$e"); + } else { + $io->error($e->getMessage()); } - $io->error($e->getMessage()); return $e->getCode() !== 0 ? (int)$e->getCode() : 1; }