File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change 3636use Hyperf \Server \Event ;
3737use Hyperf \Server \Server as AsyncStyleServer ;
3838use Hyperf \Server \ServerManager ;
39+ use Hyperf \Utils \SafeCaller ;
3940use Hyperf \WebSocketServer \Collector \FdCollector ;
4041use Hyperf \WebSocketServer \Context as WsContext ;
4142use Hyperf \WebSocketServer \Exception \Handler \WebSocketExceptionHandler ;
@@ -160,7 +161,12 @@ public function onHandShake($request, $response): void
160161 }
161162 } catch (Throwable $ throwable ) {
162163 // Delegate the exception to exception handler.
163- $ psr7Response = $ this ->exceptionHandlerDispatcher ->dispatch ($ throwable , $ this ->exceptionHandlers );
164+ $ psr7Response = $ this ->container ->get (SafeCaller::class)->call (function () use ($ throwable ) {
165+ return $ this ->exceptionHandlerDispatcher ->dispatch ($ throwable , $ this ->exceptionHandlers );
166+ }, static function () {
167+ return (new Psr7Response ())->withStatus (400 );
168+ });
169+
164170 isset ($ fd ) && FdCollector::del ($ fd );
165171 isset ($ fd ) && WsContext::release ($ fd );
166172 } finally {
You can’t perform that action at this time.
0 commit comments