Log possible exception caused by wrong version number
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
This commit is contained in:
parent
ac939e8fd4
commit
3d80ade8d7
1 changed files with 15 additions and 10 deletions
|
@ -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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue