From 804c9f1c6622aa03ec3c97d600ba9b7c6e770172 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20M=C3=BCnch?= Date: Tue, 11 Apr 2023 11:49:01 +0200 Subject: [PATCH] Add a way to debug errors of bin/magento Also relates to #1164 --- CHANGELOG.md | 1 + src/N98/Magento/Application.php | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index abf1cb29..49059d86 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ RECENT CHANGES - Add: New commands to manage sales sequences (by Jeroen Boersma) - Add: New command to redeploy base packages (by Christian Münch) +- Imp: Add debug output if Magento Core Commands cannot be used (by Christian Münch) 7.0.3 ----- diff --git a/src/N98/Magento/Application.php b/src/N98/Magento/Application.php index 95d9da45..175da7c0 100644 --- a/src/N98/Magento/Application.php +++ b/src/N98/Magento/Application.php @@ -533,9 +533,16 @@ public function registerMagentoCoreCommands(OutputInterface $output): void ); $coreCommands = $provider->getCommands(); } catch (\Exception $e) { + if (OutputInterface::VERBOSITY_DEBUG <= $output->getVerbosity()) { + $output->writeln( + sprintf('Exception: %s', $e->getMessage()) + ); + } + $output->writeln( [ 'Magento Core Commands cannot be loaded. Please verify if "bin/magento" is running.', + 'Run with -vvv option to see the error output.', 'Only n98-magerun2 commands are available until the issue is fixed.' ] );