From 3401be216d6b0f147e0a5655a7750fa5eb4012e3 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 8 Feb 2021 19:13:25 +0100 Subject: [PATCH] forward original query exception when querying by name fails Signed-off-by: Robin Appelman --- lib/private/AppFramework/Utility/SimpleContainer.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/private/AppFramework/Utility/SimpleContainer.php b/lib/private/AppFramework/Utility/SimpleContainer.php index f73e09e645..cf70a603ac 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(), $e2->getCode(), $e); + } } throw $e;