diff --git a/src/Servers/Reverb/Http/Server.php b/src/Servers/Reverb/Http/Server.php index decdeeb7..fddd88b4 100644 --- a/src/Servers/Reverb/Http/Server.php +++ b/src/Servers/Reverb/Http/Server.php @@ -9,6 +9,7 @@ use React\EventLoop\LoopInterface; use React\Socket\ConnectionInterface; use React\Socket\ServerInterface; +use Throwable; class Server { @@ -72,7 +73,11 @@ protected function handleRequest(string $message, Connection $connection): void $connection->connect(); - $this->router->dispatch($request, $connection); + try { + $this->router->dispatch($request, $connection); + } catch (Throwable $e) { + $this->close($connection, 500, 'Internal Server Error'); + } } /**