Skip to content

Commit bb0a358

Browse files
authored
Merge pull request #760 from lyrixx/better-exception
Better exception
2 parents 289f4b3 + 8bd7794 commit bb0a358

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/SPC/command/BaseCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
8080
$this->output = $output;
8181

8282
global $ob_logger;
83-
if ($input->getOption('debug')) {
83+
if ($input->getOption('debug') || $output->getVerbosity() > OutputInterface::VERBOSITY_NORMAL) {
8484
$ob_logger = new ConsoleLogger(LogLevel::DEBUG, decorated: !$input->getOption('no-ansi'));
8585
define('DEBUG_MODE', true);
8686
} else {

src/SPC/store/Downloader.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -537,10 +537,10 @@ public static function curlExec(string $url, string $method = 'GET', array $head
537537
}
538538
f_exec($cmd, $output, $ret);
539539
if ($ret === 2 || $ret === -1073741510) {
540-
throw new RuntimeException('failed http fetch');
540+
throw new RuntimeException(sprintf('Failed to fetch "%s"', $url));
541541
}
542542
if ($ret !== 0) {
543-
throw new DownloaderException('failed http fetch');
543+
throw new DownloaderException(sprintf('Failed to fetch "%s"', $url));
544544
}
545545
$cache[$cmd]['cache'] = implode("\n", $output);
546546
$cache[$cmd]['expire'] = time() + 3600;
@@ -549,10 +549,10 @@ public static function curlExec(string $url, string $method = 'GET', array $head
549549
}
550550
f_exec($cmd, $output, $ret);
551551
if ($ret === 2 || $ret === -1073741510) {
552-
throw new RuntimeException('failed http fetch');
552+
throw new RuntimeException(sprintf('Failed to fetch "%s"', $url));
553553
}
554554
if ($ret !== 0) {
555-
throw new DownloaderException('failed http fetch');
555+
throw new DownloaderException(sprintf('Failed to fetch "%s"', $url));
556556
}
557557
return implode("\n", $output);
558558
}

0 commit comments

Comments
 (0)