Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/deck.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2022-10-20 09:53:58 +0300
committerJoas Schilling <coding@schilljs.com>2022-10-20 09:53:58 +0300
commitd58f5e2bdb4ac3640c287e24b065a0b9b6bcb494 (patch)
tree823ea2fe591940b480a26dfa8c0d90be3bc96cc7
parent4b62c34cc35688a1f8722a092ab5cd413cb321b9 (diff)
Don't crash with incompatible share providers on updatesbugfix/4138/catch-throwable-on-update-scenarios
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r--lib/AppInfo/Application.php13
-rw-r--r--lib/Service/AttachmentService.php14
2 files changed, 25 insertions, 2 deletions
diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php
index edbd2b3a..278aee6f 100644
--- a/lib/AppInfo/Application.php
+++ b/lib/AppInfo/Application.php
@@ -75,7 +75,9 @@ use OCP\Notification\IManager as NotificationManager;
use OCP\Share\IManager;
use OCP\User\Events\UserDeletedEvent;
use OCP\Util;
+use Psr\Container\ContainerExceptionInterface;
use Psr\Container\ContainerInterface;
+use Psr\Log\LoggerInterface;
class Application extends App implements IBootstrap {
public const APP_ID = 'deck';
@@ -102,7 +104,16 @@ class Application extends App implements IBootstrap {
$context->injectFn(Closure::fromCallable([$this, 'registerCollaborationResources']));
$context->injectFn(function (IManager $shareManager) {
- $shareManager->registerShareProvider(DeckShareProvider::class);
+ try {
+ $shareManager->registerShareProvider(DeckShareProvider::class);
+ } catch (\Throwable $e) {
+ if (!$e instanceof ContainerExceptionInterface) {
+ Server::get(LoggerInterface::class)->error(
+ $e->getMessage(),
+ ['exception' => $e]
+ );
+ }
+ }
});
$context->injectFn(function (Listener $listener, IEventDispatcher $eventDispatcher) {
diff --git a/lib/Service/AttachmentService.php b/lib/Service/AttachmentService.php
index c7c4532a..ed398144 100644
--- a/lib/Service/AttachmentService.php
+++ b/lib/Service/AttachmentService.php
@@ -40,6 +40,9 @@ use OCP\AppFramework\Db\IMapperException;
use OCP\AppFramework\Http\Response;
use OCP\IL10N;
use OCP\IUserManager;
+use OCP\Server;
+use Psr\Container\ContainerExceptionInterface;
+use Psr\Log\LoggerInterface;
class AttachmentService {
private $attachmentMapper;
@@ -94,7 +97,16 @@ class AttachmentService {
* @throws \OCP\AppFramework\QueryException
*/
public function registerAttachmentService($type, $class) {
- $this->services[$type] = $this->application->getContainer()->query($class);
+ try {
+ $this->services[$type] = $this->application->getContainer()->query($class);
+ } catch (\Throwable $e) {
+ if (!$e instanceof ContainerExceptionInterface) {
+ Server::get(LoggerInterface::class)->error(
+ $e->getMessage(),
+ ['exception' => $e]
+ );
+ }
+ }
}
/**