Fix exception handling

main
Jordi Boggiano 12 years ago
parent 1e2223bcdb
commit 7285536737

@ -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 <j.boggiano@seld.be>
@ -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);

@ -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.')'
);
}

Loading…
Cancel
Save