@@ -559,12 +559,18 @@ class DevHandler {
559559 final appDebugServices = await loadAppServices (appConnection);
560560
561561 // Initialize WebSocket proxy service
562- final proxyService = appDebugServices.proxyService;
563- if (proxyService is WebSocketProxyService ) {
562+ try {
563+ final proxyService = appDebugServices.proxyService;
564+ if (proxyService is ! WebSocketProxyService ) {
565+ throw StateError (
566+ 'Expected WebSocketProxyService but got ${proxyService .runtimeType }. ' ,
567+ );
568+ }
564569 await proxyService.isInitialized;
565570 _logger.fine ('WebSocket proxy service initialized successfully' );
566- } else {
567- _logger.warning ('WebSocket proxy service is null' );
571+ } catch (e) {
572+ _logger.severe ('Failed to initialize WebSocket proxy service: $e ' );
573+ rethrow ;
568574 }
569575
570576 return DebugConnection (appDebugServices);
@@ -579,12 +585,13 @@ class DevHandler {
579585 // Initialize Chrome proxy service
580586 try {
581587 final proxyService = appDebugServices.proxyService;
582- if (proxyService is ChromeProxyService ) {
583- await proxyService.isInitialized;
584- _logger.fine ('Chrome proxy service initialized successfully' );
585- } else {
586- _logger.warning ('Chrome proxy service is null' );
588+ if (proxyService is ! ChromeProxyService ) {
589+ throw StateError (
590+ 'Expected ChromeProxyService but got ${proxyService .runtimeType }. ' ,
591+ );
587592 }
593+ await proxyService.isInitialized;
594+ _logger.fine ('Chrome proxy service initialized successfully' );
588595 } catch (e) {
589596 _logger.severe ('Failed to initialize Chrome proxy service: $e ' );
590597 rethrow ;
0 commit comments