summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorChristoph Wurst <ChristophWurst@users.noreply.github.com>2021-02-09 14:27:43 +0100
committerGitHub <noreply@github.com>2021-02-09 14:27:43 +0100
commit4c6bc62f38616c219be0667bf335c1b70f5ec1aa (patch)
treef8d642139ffe5c512e9a0347a92126cd9661c1e5 /lib
parenta36186980dec315929a7e816042d613134bf7039 (diff)
parentec875227ec494edb619eee5b413d2e4dd344b4cb (diff)
downloadnextcloud-server-4c6bc62f38616c219be0667bf335c1b70f5ec1aa.tar.gz
nextcloud-server-4c6bc62f38616c219be0667bf335c1b70f5ec1aa.zip
Merge pull request #25535 from nextcloud/query-exception-foreward
Improve exception when auto-wiring fails
Diffstat (limited to 'lib')
-rw-r--r--lib/private/AppFramework/Utility/SimpleContainer.php7
-rw-r--r--lib/private/Console/Application.php6
2 files changed, 11 insertions, 2 deletions
diff --git a/lib/private/AppFramework/Utility/SimpleContainer.php b/lib/private/AppFramework/Utility/SimpleContainer.php
index f73e09e645e..2aa5da116e6 100644
--- a/lib/private/AppFramework/Utility/SimpleContainer.php
+++ b/lib/private/AppFramework/Utility/SimpleContainer.php
@@ -93,7 +93,12 @@ class SimpleContainer implements ArrayAccess, ContainerInterface, IContainer {
if ($parameterType !== null && !$parameterType->isBuiltin()) {
$resolveName = $parameter->getName();
- return $this->query($resolveName);
+ try {
+ return $this->query($resolveName);
+ } catch (QueryException $e2) {
+ // don't lose the error we got while trying to query by type
+ throw new QueryException($e2->getMessage(), (int) $e2->getCode(), $e);
+ }
}
throw $e;
diff --git a/lib/private/Console/Application.php b/lib/private/Console/Application.php
index 10c578f41e0..9b1cc57aed3 100644
--- a/lib/private/Console/Application.php
+++ b/lib/private/Console/Application.php
@@ -221,7 +221,11 @@ class Application {
$c = \OC::$server->query($command);
} catch (QueryException $e) {
if (class_exists($command)) {
- $c = new $command();
+ try {
+ $c = new $command();
+ } catch (\ArgumentCountError $e2) {
+ throw new \Exception("Failed to construct console command '$command': " . $e->getMessage(), 0, $e);
+ }
} else {
throw new \Exception("Console command '$command' is unknown and could not be loaded");
}