1
0
Fork 0

Fix exception handling

pull/498/head
Jordi Boggiano 2012-03-25 00:39:28 +01:00
parent 1e2223bcdb
commit 7285536737
2 changed files with 11 additions and 6 deletions

View File

@ -17,6 +17,7 @@ use Composer\Util\ProcessExecutor;
use Composer\Util\Filesystem; use Composer\Util\Filesystem;
use Composer\Util\Svn as SvnUtil; use Composer\Util\Svn as SvnUtil;
use Composer\IO\IOInterface; use Composer\IO\IOInterface;
use Composer\Downloader\TransportException;
/** /**
* @author Jordi Boggiano <j.boggiano@seld.be> * @author Jordi Boggiano <j.boggiano@seld.be>
@ -128,9 +129,13 @@ class SvnDriver extends VcsDriver
$rev = ''; $rev = '';
} }
$output = $this->execute('svn cat', $this->baseUrl . $identifier . 'composer.json' . $rev); try {
if (!trim($output)) { $output = $this->execute('svn cat', $this->baseUrl . $identifier . 'composer.json' . $rev);
return; if (!trim($output)) {
return;
}
} catch (\RuntimeException $e) {
throw new TransportException($e->getMessage());
} }
$composer = JsonFile::parseJson($output); $composer = JsonFile::parseJson($output);

View File

@ -89,13 +89,13 @@ class Svn
// the error is not auth-related // the error is not auth-related
if (false === stripos($output, 'authorization failed:')) { 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 // no auth supported for non interactive calls
if (!$this->io->isInteractive()) { if (!$this->io->isInteractive()) {
throw new \RuntimeException( 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( throw new \RuntimeException(
'Repository '.$this->url.' could not be processed, wrong credentials provided ('.$output.')' 'wrong credentials provided ('.$output.')'
); );
} }