forward original query exception when querying by name fails

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2021-02-08 19:13:25 +01:00
parent 26a20ed13f
commit 3401be216d
No known key found for this signature in database
GPG Key ID: 42B69D8A64526EFB
1 changed files with 6 additions and 1 deletions

View File

@ -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;