diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-06-17 21:07:42 +0200 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-06-17 21:07:42 +0200 |
commit | 5ab5a5f89eb81b16be7cac83fab0ba37f45718b4 (patch) | |
tree | b875a5c254f5803ae07631403b8f3d0c6f03bd6f | |
parent | e64e2d66a6d5a595acc05986514eda503912aa55 (diff) | |
download | nextcloud-server-5ab5a5f89eb81b16be7cac83fab0ba37f45718b4.tar.gz nextcloud-server-5ab5a5f89eb81b16be7cac83fab0ba37f45718b4.zip |
Catch all exceptions when an app is registering or booting
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
-rw-r--r-- | lib/private/AppFramework/Bootstrap/Coordinator.php | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/private/AppFramework/Bootstrap/Coordinator.php b/lib/private/AppFramework/Bootstrap/Coordinator.php index e713ad7ce91..08951419906 100644 --- a/lib/private/AppFramework/Bootstrap/Coordinator.php +++ b/lib/private/AppFramework/Bootstrap/Coordinator.php @@ -32,6 +32,7 @@ use OCP\AppFramework\QueryException; use OCP\EventDispatcher\IEventDispatcher; use OCP\ILogger; use OCP\IServerContainer; +use Throwable; use function class_exists; use function class_implements; use function in_array; @@ -81,9 +82,17 @@ class Coordinator { try { /** @var IBootstrap|App $application */ $apps[$appId] = $application = $this->serverContainer->query($applicationClassName); - $application->register($context->for($appId)); } catch (QueryException $e) { // Weird, but ok + return; + } + try { + $application->register($context->for($appId)); + } catch (Throwable $e) { + $this->logger->logException($e, [ + 'message' => 'Error during app service registration: ' . $e->getMessage(), + 'level' => ILogger::FATAL, + ]); } } } @@ -125,6 +134,11 @@ class Coordinator { 'message' => "Could not boot $appId" . $e->getMessage(), ]); return; + } catch (Throwable $e) { + $this->logger->logException($e, [ + 'message' => "Could not boot $appId" . $e->getMessage(), + 'level' => ILogger::FATAL, + ]); } } } |