Merge pull request #6458 from nextcloud/rethrow-correct-exception

Rethrow the correct exception when there was an error in an app conta…
This commit is contained in:
Morris Jobke 2017-09-14 00:32:13 +02:00 committed by GitHub
commit 883574974d
1 changed files with 10 additions and 3 deletions

View File

@ -412,8 +412,15 @@ class DIContainer extends SimpleContainer implements IAppContainer {
public function query($name) {
try {
return $this->queryNoFallback($name);
} catch (QueryException $e) {
return $this->getServer()->query($name);
} catch (QueryException $firstException) {
try {
return $this->getServer()->query($name);
} catch (QueryException $secondException) {
if ($firstException->getCode() === 1) {
throw $secondException;
}
throw $firstException;
}
}
}
@ -438,6 +445,6 @@ class DIContainer extends SimpleContainer implements IAppContainer {
}
throw new QueryException('Could not resolve ' . $name . '!' .
' Class can not be instantiated');
' Class can not be instantiated', 1);
}
}