1
0
Fork 0
mirror of synced 2024-06-27 02:31:04 +12:00

Remove PDO rethrow

The PDOException was rethrown in general.php so that it could be caught
in the catch block of http.php. However, [a change in
utopia-php/framework](9d37326851)
caused the exception to be masked as an Exception rather than the
underlying PDOException. As such, the `$th instanceof PDOException` in
http.php is always false and `$db = null` is never executed. Since these
snippets of code aren't doing anything or adding value, they should be
removed.

In addition, the `$db = null` may have been added to ensure the
connection was added back to the pool and/or reset if needed, but it
seems like that's not a problem anymore.
This commit is contained in:
Steven Nguyen 2022-10-21 14:37:28 -07:00
parent 4942ba9951
commit 719aa67afa
No known key found for this signature in database
2 changed files with 0 additions and 12 deletions

View file

@ -403,11 +403,6 @@ App::error()
$version = App::getEnv('_APP_VERSION', 'UNKNOWN');
$route = $utopia->match($request);
/** Delegate PDO exceptions to the global handler so the database connection can be returned to the pool */
if ($error instanceof PDOException) {
throw $error;
}
if ($logger) {
if ($error->getCode() >= 500 || $error->getCode() === 0) {
try {

View file

@ -317,13 +317,6 @@ $http->on('request', function (SwooleRequest $swooleRequest, SwooleResponse $swo
Console::error('[Error] File: ' . $th->getFile());
Console::error('[Error] Line: ' . $th->getLine());
/**
* Reset Database connection if PDOException was thrown.
*/
if ($th instanceof PDOException) {
$db = null;
}
$swooleResponse->setStatusCode(500);
$output = ((App::isDevelopment())) ? [