mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
fix(http): reset pdo connection if broken
This commit is contained in:
+10
-1
@@ -98,11 +98,20 @@ $http->on('request', function (SwooleRequest $swooleRequest, SwooleResponse $swo
|
||||
|
||||
$app->run($request, $response);
|
||||
} catch (\Throwable $th) {
|
||||
Console::error('[Error] Type: '.get_class($th));
|
||||
$type = get_class($th);
|
||||
|
||||
Console::error('[Error] Type: '.$type);
|
||||
Console::error('[Error] Message: '.$th->getMessage());
|
||||
Console::error('[Error] File: '.$th->getFile());
|
||||
Console::error('[Error] Line: '.$th->getLine());
|
||||
|
||||
/**
|
||||
* Reset Database connection if PDOException was thrown.
|
||||
*/
|
||||
if ($type === 'PDOException') {
|
||||
$db = null;
|
||||
}
|
||||
|
||||
if(App::isDevelopment()) {
|
||||
$swooleResponse->end('error: '.$th->getMessage());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user