@@ -110,22 +110,29 @@ const SpeedTest = {
110110 // Generate a random UUID
111111 const sessionID = crypto . randomUUID ( ) ;
112112
113- // Randomly choose which test to start first
114- if ( Math . random ( ) < 0.5 ) {
115- await this . runNdt7 ( sessionID ) ;
116- await this . runMSAK ( sessionID ) ;
117- } else {
118- await this . runMSAK ( sessionID ) ;
119- await this . runNdt7 ( sessionID ) ;
120- }
113+ try {
114+ // Randomly choose which test to start first
115+ if ( Math . random ( ) < 0.5 ) {
116+ await this . runNdt7 ( sessionID ) ;
117+ await this . runMSAK ( sessionID ) ;
118+ } else {
119+ await this . runMSAK ( sessionID ) ;
120+ await this . runNdt7 ( sessionID ) ;
121+ }
121122
122- this . runPT ( sessionID ) ;
123+ this . runPT ( sessionID ) ;
123124
124- this . els . currentPhase . textContent = i18n . t ( 'Complete' ) ;
125- this . els . currentSpeed . textContent = '' ;
126- this . measurementComplete = true ;
127- this . testRunning = false ;
128- this . updateUI ( ) ;
125+ this . els . currentPhase . textContent = i18n . t ( 'Complete' ) ;
126+ this . els . currentSpeed . textContent = '' ;
127+ this . measurementComplete = true ;
128+ } catch ( err ) {
129+ console . error ( 'Speed test failed:' , err ) ;
130+ this . els . currentPhase . textContent = i18n . t ( 'Error' ) ;
131+ this . els . currentSpeed . textContent = i18n . t ( 'Test failed. Please try again.' ) ;
132+ } finally {
133+ this . testRunning = false ;
134+ this . updateUI ( ) ;
135+ }
129136 } ,
130137
131138 /**
0 commit comments