1
0
Fork 0
mirror of synced 2024-06-02 19:04:49 +12:00

fix(http): reset pdo connection if broken

This commit is contained in:
Torsten Dittmann 2021-07-12 12:04:00 +02:00
parent bb95ec536b
commit df24011d8b

View file

@ -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());
}