diff options
author | Anna Larch <anna@nextcloud.com> | 2021-06-15 11:36:36 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-15 11:36:36 +0300 |
commit | 3431697ec2aa1b19e6f3b6a8fede7430d01fe30d (patch) | |
tree | f0d90bedcd02fe18f1d37acf6c53756856529160 /lib/Service | |
parent | 493c9a22a2ccbcf0971805d107a993dbdc234d98 (diff) | |
parent | cc29931388c6d03f92ccc96da049aa73e94c3974 (diff) |
Merge pull request #5175 from nextcloud/fix/wrap-classifier-exceptions-and-remove-throwable
Wrap Exceptions in ServiceException and remove Throwable exception
Diffstat (limited to 'lib/Service')
-rw-r--r-- | lib/Service/Classification/PersistenceService.php | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Service/Classification/PersistenceService.php b/lib/Service/Classification/PersistenceService.php index 5d364f451..b9ba94fa1 100644 --- a/lib/Service/Classification/PersistenceService.php +++ b/lib/Service/Classification/PersistenceService.php @@ -183,7 +183,12 @@ class PersistenceService { throw new ServiceException("Could not load classifier $id: " . $e->getMessage(), 0, $e); } - $serialized = $modelFile->getContent(); + try { + $serialized = $modelFile->getContent(); + } catch (NotFoundException | NotPermittedException $e) { + $this->logger->debug("Could not load content for model file with classifier id $id: " . $e->getMessage()); + throw new ServiceException("Could not load content for model file with classifier id $id: " . $e->getMessage(), 0, $e); + } $size = strlen($serialized); $this->logger->debug("Serialized classifier loaded (size=$size)"); |