Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Catch all exceptions when an app is registering or booting
Signed-off-by: Christoph Wurst <[email protected]>
  • Loading branch information
ChristophWurst committed Jun 17, 2020
commit 5ab5a5f89eb81b16be7cac83fab0ba37f45718b4
16 changes: 15 additions & 1 deletion lib/private/AppFramework/Bootstrap/Coordinator.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
use OCP\EventDispatcher\IEventDispatcher;
use OCP\ILogger;
use OCP\IServerContainer;
use Throwable;
use function class_exists;
use function class_implements;
use function in_array;
Expand Down Expand Up @@ -81,9 +82,17 @@ public function runRegistration(): void {
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,
]);
}
}
}
Expand Down Expand Up @@ -125,6 +134,11 @@ public function bootApp(string $appId): void {
'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,
]);
}
}
}