Log possible exception caused by wrong version number

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
This commit is contained in:
Morris Jobke 2018-04-11 00:05:42 +02:00 committed by Roeland Jago Douma
parent ac939e8fd4
commit 3d80ade8d7
No known key found for this signature in database
GPG key ID: F941078878347C0C

View file

@ -33,6 +33,7 @@ use OCP\AppFramework\Utility\ITimeFactory;
use OCP\Http\Client\IClientService;
use OCP\IConfig;
use OCP\ILogger;
use OCP\Util;
class AppFetcher extends Fetcher {
@ -87,16 +88,20 @@ class AppFetcher extends Fetcher {
if($release['isNightly'] === false
&& strpos($release['version'], '-') === false) {
// Exclude all versions not compatible with the current version
$versionParser = new VersionParser();
$version = $versionParser->getVersion($release['rawPlatformVersionSpec']);
$ncVersion = $this->getVersion();
$min = $version->getMinimumVersion();
$max = $version->getMaximumVersion();
$minFulfilled = $this->compareVersion->isCompatible($ncVersion, $min, '>=');
$maxFulfilled = $max !== '' &&
$this->compareVersion->isCompatible($ncVersion, $max, '<=');
if ($minFulfilled && $maxFulfilled) {
$releases[] = $release;
try {
$versionParser = new VersionParser();
$version = $versionParser->getVersion($release['rawPlatformVersionSpec']);
$ncVersion = $this->getVersion();
$min = $version->getMinimumVersion();
$max = $version->getMaximumVersion();
$minFulfilled = $this->compareVersion->isCompatible($ncVersion, $min, '>=');
$maxFulfilled = $max !== '' &&
$this->compareVersion->isCompatible($ncVersion, $max, '<=');
if ($minFulfilled && $maxFulfilled) {
$releases[] = $release;
}
} catch (\InvalidArgumentException $e) {
$this->logger->logException($e, ['app' => 'appstoreFetcher', 'level' => Util::WARN]);
}
}
}