@@ -559,12 +559,18 @@ class DevHandler {
559
559
final appDebugServices = await loadAppServices (appConnection);
560
560
561
561
// 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
+ }
564
569
await proxyService.isInitialized;
565
570
_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 ;
568
574
}
569
575
570
576
return DebugConnection (appDebugServices);
@@ -579,12 +585,13 @@ class DevHandler {
579
585
// Initialize Chrome proxy service
580
586
try {
581
587
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
+ );
587
592
}
593
+ await proxyService.isInitialized;
594
+ _logger.fine ('Chrome proxy service initialized successfully' );
588
595
} catch (e) {
589
596
_logger.severe ('Failed to initialize Chrome proxy service: $e ' );
590
597
rethrow ;
0 commit comments