Browse Source

Catch PharException as well in self-update failures

Jordi Boggiano 13 years ago
parent
commit
7f0a0857c0
1 changed files with 4 additions and 1 deletions
  1. 4 1
      src/Composer/Command/SelfUpdateCommand.php

+ 4 - 1
src/Composer/Command/SelfUpdateCommand.php

@@ -59,7 +59,10 @@ EOT
                 // free the variable to unlock the file
                 unset($phar);
                 rename($tempFilename, $localFilename);
-            } catch (\UnexpectedValueException $e) {
+            } catch (\Exception $e) {
+                if (!$e instanceof \UnexpectedValueException && !$e instanceof \PharException) {
+                    throw $e;
+                }
                 unlink($tempFilename);
                 $output->writeln('<error>The download is corrupt ('.$e->getMessage().').</error>');
                 $output->writeln('<error>Please re-run the self-update command to try again.</error>');