@@ -498,7 +498,10 @@ function openImageContinuousSocket(socketIndex, runToken, prompt, aspectRatio, a
498498 socketState . active = status === 'running' ;
499499 updateImageContinuousStats ( ) ;
500500 if ( imageContinuousRunning ) {
501- if ( status === 'running' ) setImageStatusText ( 'Running' ) ;
501+ if ( status === 'running' ) {
502+ clearImageContinuousError ( ) ;
503+ setImageStatusText ( 'Running' ) ;
504+ }
502505 if ( status === 'stopped' ) setImageStatusText ( 'Stopped' ) ;
503506 }
504507 updateImageContinuousButtons ( ) ;
@@ -507,6 +510,7 @@ function openImageContinuousSocket(socketIndex, runToken, prompt, aspectRatio, a
507510
508511 if ( msgType === 'image' ) {
509512 socketState . active = true ;
513+ clearImageContinuousError ( ) ;
510514 appendWaterfallImage ( data , socketIndex ) ;
511515 if ( imageContinuousRunning ) setImageStatusText ( 'Running' ) ;
512516 updateImageContinuousButtons ( ) ;
@@ -545,7 +549,14 @@ function openImageContinuousSocket(socketIndex, runToken, prompt, aspectRatio, a
545549 setImageContinuousError ( 'WebSocket auth rejected. Check API key.' ) ;
546550 setImageStatusText ( 'Auth failed' ) ;
547551 } else if ( socketState . hadError && stillActive <= 0 && stillOpen <= 0 ) {
548- setImageContinuousError ( socketState . lastError || `WS${ socketIndex + 1 } connection error` ) ;
552+ const closeCode = Number ( event ?. code || 0 ) ;
553+ const closeReason = String ( event ?. reason || '' ) . trim ( ) ;
554+ if ( closeCode > 0 ) {
555+ const suffix = closeReason ? `: ${ closeReason } ` : '' ;
556+ setImageContinuousError ( `WebSocket closed (${ closeCode } )${ suffix } ` ) ;
557+ } else {
558+ setImageContinuousError ( socketState . lastError || `WS${ socketIndex + 1 } connection error` ) ;
559+ }
549560 setImageStatusText ( 'Disconnected' ) ;
550561 }
551562
0 commit comments