This repository was archived by the owner on Nov 14, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change 5
5
use Distill \Distill ;
6
6
use Distill \Strategy \MinimumSize ;
7
7
use GuzzleHttp \Client ;
8
+ use GuzzleHttp \Exception \ClientException ;
8
9
use GuzzleHttp \Message \Response ;
9
10
use GuzzleHttp \Subscriber \Progress \Progress ;
10
11
use Symfony \Component \Console \Command \Command ;
@@ -232,7 +233,27 @@ private function download()
232
233
// store the file in a temporary hidden directory with a random name
233
234
$ this ->compressedFilePath = getcwd ().DIRECTORY_SEPARATOR .'. ' .uniqid (time ()).DIRECTORY_SEPARATOR .'symfony. ' .pathinfo ($ symfonyArchiveFile , PATHINFO_EXTENSION );
234
235
235
- $ response = $ client ->get ($ symfonyArchiveFile );
236
+ try {
237
+ $ response = $ client ->get ($ symfonyArchiveFile );
238
+ } catch (ClientException $ e ) {
239
+ if ($ e ->getCode () === 503 || $ e ->getCode () === 504 ) {
240
+ throw new \RuntimeException (sprintf (
241
+ 'The selected version (%s) cannot be installed because it does not exist. ' .
242
+ "Try the special \"latest \" version to install the latest stable Symfony release: \n" .
243
+ 'php ./symfony %s %s latest ' ,
244
+ $ this ->getName (),
245
+ $ this ->version ,
246
+ $ this ->projectName
247
+ ));
248
+ } else {
249
+ throw new \RuntimeException (sprintf (
250
+ "The selected version (%s) couldn\'t be downloaded because of the following error: \n%s " ,
251
+ $ this ->version ,
252
+ $ e ->getMessage ()
253
+ ));
254
+ }
255
+ }
256
+
236
257
$ this ->fs ->dumpFile ($ this ->compressedFilePath , $ response ->getBody ());
237
258
238
259
if (null !== $ progressBar ) {
You can’t perform that action at this time.
0 commit comments