From 728553673777e9c362846f5d0b5d49543fe27cd2 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Sun, 25 Mar 2012 00:39:28 +0100 Subject: [PATCH] Fix exception handling --- src/Composer/Repository/Vcs/SvnDriver.php | 11 ++++++++--- src/Composer/Util/Svn.php | 6 +++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/Composer/Repository/Vcs/SvnDriver.php b/src/Composer/Repository/Vcs/SvnDriver.php index 4d6d895b5..b18f362c3 100644 --- a/src/Composer/Repository/Vcs/SvnDriver.php +++ b/src/Composer/Repository/Vcs/SvnDriver.php @@ -17,6 +17,7 @@ use Composer\Util\ProcessExecutor; use Composer\Util\Filesystem; use Composer\Util\Svn as SvnUtil; use Composer\IO\IOInterface; +use Composer\Downloader\TransportException; /** * @author Jordi Boggiano @@ -128,9 +129,13 @@ class SvnDriver extends VcsDriver $rev = ''; } - $output = $this->execute('svn cat', $this->baseUrl . $identifier . 'composer.json' . $rev); - if (!trim($output)) { - return; + try { + $output = $this->execute('svn cat', $this->baseUrl . $identifier . 'composer.json' . $rev); + if (!trim($output)) { + return; + } + } catch (\RuntimeException $e) { + throw new TransportException($e->getMessage()); } $composer = JsonFile::parseJson($output); diff --git a/src/Composer/Util/Svn.php b/src/Composer/Util/Svn.php index d03c8a0e1..175ae3fc5 100644 --- a/src/Composer/Util/Svn.php +++ b/src/Composer/Util/Svn.php @@ -89,13 +89,13 @@ class Svn // the error is not auth-related if (false === stripos($output, 'authorization failed:')) { - throw new \RuntimeException('Package could not be downloaded: '.$output); + throw new \RuntimeException($output); } // no auth supported for non interactive calls if (!$this->io->isInteractive()) { throw new \RuntimeException( - 'Package could not be downloaded, can not ask for authentication in non interactive mode ('.$output.')' + 'can not ask for authentication in non interactive mode ('.$output.')' ); } @@ -111,7 +111,7 @@ class Svn } throw new \RuntimeException( - 'Repository '.$this->url.' could not be processed, wrong credentials provided ('.$output.')' + 'wrong credentials provided ('.$output.')' ); }