@@ -82,7 +82,7 @@ public function __construct($socket, Websocket $application, array $headers = []
8282 $ this ->socket = $ socket ;
8383 $ this ->parser = $ this ->parser ([$ this , "onParse " ]);
8484 $ this ->writeWatcher = \Amp \onWritable ($ socket , [$ this , "onWritable " ], $ options = ["enable " => false ]);
85- \Amp \resolve ($ this ->tryAppOnOpen ($ headers ));
85+ \Amp \resolve ($ this ->tryAppOnOpen ($ headers ))-> when ( function ( $ e ){ if ( $ e ) throw $ e ; }) ;
8686 }
8787
8888 private function tryAppOnOpen ($ headers ) {
@@ -212,7 +212,7 @@ private function onParsedData(array $parseResult) {
212212 if (!$ this ->msgPromisor ) {
213213 $ this ->msgPromisor = new Deferred ;
214214 $ msg = new Message ($ this ->msgPromisor ->promise ());
215- \Amp \resolve ($ this ->tryAppOnData ($ msg ));
215+ \Amp \resolve ($ this ->tryAppOnData ($ msg ))-> when ( function ( $ e ) { if ( $ e ) throw $ e ; }) ;
216216 }
217217
218218 $ this ->msgPromisor ->update ($ data );
@@ -249,7 +249,7 @@ private function onParsedError(array $parseResult) {
249249 }
250250
251251 if (!$ this ->closedAt ) {
252- $ this ->doClose ($ code , $ msg );
252+ $ this ->doClose ($ code , $ msg )-> when ( function ( $ e ){ if ( $ e ) throw $ e ; }) ;
253253 }
254254 }
255255 }
@@ -266,7 +266,7 @@ public function onReadable($watcherId, $socket) {
266266 $ this ->closedAt = $ this ->now ;
267267 $ code = Code::ABNORMAL_CLOSE ;
268268 $ reason = "Client closed underlying TCP connection " ;
269- \Amp \resolve ($ this ->tryAppOnClose ($ code , $ reason ));
269+ \Amp \resolve ($ this ->tryAppOnClose ($ code , $ reason ))-> when ( function ( $ e ){ if ( $ e ) throw $ e ; }) ;
270270 } else {
271271 $ this ->closeTimeout = null ;
272272 }
@@ -406,7 +406,7 @@ public function sendBinary($data) {
406406 }
407407
408408 public function close ($ code = Code::NORMAL_CLOSE , $ reason = "" ) {
409- $ this ->doClose ($ code , $ reason );
409+ $ this ->doClose ($ code , $ reason )-> when ( function ( $ e ){ if ( $ e ) throw $ e ; }) ;
410410 }
411411
412412 public function getInfo () {
0 commit comments