From 5a7db86471b1a3993587d2bc7e0abb7bbbbf77a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Pineau?= Date: Wed, 11 Jun 2025 14:20:24 +0200 Subject: [PATCH 1/2] Better exception --- src/SPC/store/Downloader.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/SPC/store/Downloader.php b/src/SPC/store/Downloader.php index c17e5b98..7efcfb3b 100644 --- a/src/SPC/store/Downloader.php +++ b/src/SPC/store/Downloader.php @@ -537,10 +537,10 @@ class Downloader } f_exec($cmd, $output, $ret); if ($ret === 2 || $ret === -1073741510) { - throw new RuntimeException('failed http fetch'); + throw new RuntimeException(sprintf('Failed to fetch "%s"', $url)); } if ($ret !== 0) { - throw new DownloaderException('failed http fetch'); + throw new DownloaderException(sprintf('Failed to fetch "%s"', $url)); } $cache[$cmd]['cache'] = implode("\n", $output); $cache[$cmd]['expire'] = time() + 3600; @@ -549,10 +549,10 @@ class Downloader } f_exec($cmd, $output, $ret); if ($ret === 2 || $ret === -1073741510) { - throw new RuntimeException('failed http fetch'); + throw new RuntimeException(sprintf('Failed to fetch "%s"', $url)); } if ($ret !== 0) { - throw new DownloaderException('failed http fetch'); + throw new DownloaderException(sprintf('Failed to fetch "%s"', $url)); } return implode("\n", $output); } From 8bd7794a2e1b597b7a01a522cbf3b1e3375e1386 Mon Sep 17 00:00:00 2001 From: Jerry Ma Date: Thu, 12 Jun 2025 11:57:42 +0800 Subject: [PATCH 2/2] Add `-v` compatibility for command --- src/SPC/command/BaseCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SPC/command/BaseCommand.php b/src/SPC/command/BaseCommand.php index c04b3fa8..832ced97 100644 --- a/src/SPC/command/BaseCommand.php +++ b/src/SPC/command/BaseCommand.php @@ -80,7 +80,7 @@ abstract class BaseCommand extends Command $this->output = $output; global $ob_logger; - if ($input->getOption('debug')) { + if ($input->getOption('debug') || $output->getVerbosity() > OutputInterface::VERBOSITY_NORMAL) { $ob_logger = new ConsoleLogger(LogLevel::DEBUG, decorated: !$input->getOption('no-ansi')); define('DEBUG_MODE', true); } else {