Fix exception handling
parent
1e2223bcdb
commit
7285536737
|
@ -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);
|
||||||
|
|
|
@ -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.')'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue