@@ -343,20 +343,25 @@ async fn handle_core(mut socket: WebSocket, feature_flags: FeatureFlags) {
343
343
344
344
// We don't care if there are no running tasks
345
345
Some ( task) = manager. join_next( ) => {
346
- let Err ( error) = task else { continue } ;
347
- // The task was cancelled; no need to report
348
- let Ok ( panic) = error. try_into_panic( ) else { continue } ;
349
-
350
- let text = match panic. downcast:: <String >( ) {
351
- Ok ( text) => * text,
352
- Err ( panic) => match panic. downcast:: <& str >( ) {
353
- Ok ( text) => text. to_string( ) ,
354
- _ => "An unknown panic occurred" . into( ) ,
346
+ let error = match task {
347
+ Ok ( Ok ( ( ) ) ) => continue ,
348
+ Ok ( Err ( error) ) => error,
349
+ Err ( error) => {
350
+ // The task was cancelled; no need to report
351
+ let Ok ( panic) = error. try_into_panic( ) else { continue } ;
352
+
353
+ let text = match panic. downcast:: <String >( ) {
354
+ Ok ( text) => * text,
355
+ Err ( panic) => match panic. downcast:: <& str >( ) {
356
+ Ok ( text) => text. to_string( ) ,
357
+ _ => "An unknown panic occurred" . into( ) ,
358
+ }
359
+ } ;
360
+ WebSocketTaskPanicSnafu { text } . build( )
355
361
}
356
362
} ;
357
- let error = WebSocketTaskPanicSnafu { text } . fail( ) ;
358
363
359
- if tx. send( error) . await . is_err( ) {
364
+ if tx. send( Err ( error) ) . await . is_err( ) {
360
365
// We can't send a response
361
366
break ;
362
367
}
0 commit comments