mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-22 08:15:35 +08:00
simplify download error message
This commit is contained in:
@@ -59,7 +59,7 @@ class DownloadCommand extends BaseCommand
|
||||
*/
|
||||
public function handle(): int
|
||||
{
|
||||
// 删除旧资源
|
||||
try {
|
||||
if ($this->getOption('clean')) {
|
||||
logger()->warning('You are doing some operations that not recoverable: removing directories below');
|
||||
logger()->warning(SOURCE_PATH);
|
||||
@@ -104,7 +104,6 @@ class DownloadCommand extends BaseCommand
|
||||
// use openssl 1.1
|
||||
if ($this->getOption('with-openssl11')) {
|
||||
logger()->debug('Using openssl 1.1');
|
||||
// 手动修改配置
|
||||
Config::$source['openssl']['regex'] = '/href="(?<file>openssl-(?<version>1.[^"]+)\.tar\.gz)\"/';
|
||||
}
|
||||
|
||||
@@ -154,10 +153,16 @@ class DownloadCommand extends BaseCommand
|
||||
Downloader::downloadSource($source, Config::getSource($source));
|
||||
}
|
||||
}
|
||||
// 打印拉取资源用时
|
||||
$time = round(microtime(true) - START_TIME, 3);
|
||||
logger()->info('Download complete, used ' . $time . ' s !');
|
||||
return static::SUCCESS;
|
||||
} catch (DownloaderException $e) {
|
||||
logger()->error($e->getMessage());
|
||||
return static::FAILURE;
|
||||
} catch (WrongUsageException $e) {
|
||||
logger()->critical($e->getMessage());
|
||||
return static::FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
private function downloadFromZip(string $path): int
|
||||
|
||||
@@ -335,7 +335,7 @@ class Downloader
|
||||
logger()->warning('Deleting download file: ' . $filename);
|
||||
unlink(DOWNLOAD_PATH . '/' . $filename);
|
||||
}
|
||||
throw $e;
|
||||
throw new DownloaderException('Download failed! ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user