-
Notifications
You must be signed in to change notification settings - Fork 114
improve error messages when the download fails #59
Conversation
try { | ||
$response = $client->get($symfonyArchiveFile); | ||
} catch (ClientException $e) { | ||
if ($e->getCode() === 403 || $e->getCode() === 404) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The check for 403
can be removed once the download site returns proper error codes when a file could not be found.
} catch (ClientException $e) { | ||
if ($e->getCode() === 403 || $e->getCode() === 404) { | ||
throw new \RuntimeException(sprintf( | ||
"The selected version (%s) cannot be installed because it does not exist. ". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At first I didn't see that this line doesn't contain a \n
. Don't you think that the resulting error message would be too long? I love the way the message looks in the source code and I guess that it would be great to maintain that same format in the command console.
@javiereguiluz The line break makes sense. It now looks like this: While before it has been: |
However, I also decided to simply show "php symfony new project-name latest" as a suggestion instead of trying to build the original command since that's how it ends up for users if they follow the installation instructions. |
👍 everything looks good to me. Thanks @xabbuh! |
Thank you @xabbuh. |
This PR was merged into the 1.0-dev branch. Discussion ---------- improve error messages when the download fails This pull request addresses #48. Commits ------- cadccd3 improve error messages when the download fails
This PR was merged into the 1.0-dev branch. Discussion ---------- suggest to use symfony.phar on Windows The command that is suggested since #59 when the download of a non-existent Symfony version fails, is not sufficient on Windows. We need to suggest `php symfony.phar ...` instead. Commits ------- 6a7324d suggest to use symfony.phar on Windows
This pull request addresses #48.