Skip to content

Commit 308478f

Browse files
committed
addressed comments
1 parent 4b82b4c commit 308478f

File tree

1 file changed

+5
-18
lines changed

1 file changed

+5
-18
lines changed

dwds/lib/src/services/web_socket_proxy_service.dart

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,8 @@ class _ServiceExtensionTracker {
120120
/// Exception thrown when no browser clients are connected to DWDS.
121121
class NoClientsAvailableException implements Exception {
122122
final String message;
123-
final String operation;
124123

125-
NoClientsAvailableException(this.message, {required this.operation});
124+
NoClientsAvailableException(this.message);
126125

127126
@override
128127
String toString() => 'NoClientsAvailableException: $message';
@@ -517,7 +516,6 @@ class WebSocketProxyService extends ProxyService {
517516
return _ReloadReportWithMetadata(success: true);
518517
} on NoClientsAvailableException catch (e) {
519518
// Gracefully handle no clients scenario
520-
_logger.info('No clients available for hot reload');
521519
return _ReloadReportWithMetadata(
522520
success: false,
523521
notices: [e.message],
@@ -541,11 +539,7 @@ class WebSocketProxyService extends ProxyService {
541539
// Return structured response indicating no clients available
542540
_logger.info('No clients available for hot restart');
543541
return {
544-
'result': {
545-
'type': 'Success',
546-
'noClientsAvailable': true,
547-
'message': e.message,
548-
},
542+
'result': {'noClientsAvailable': true, 'message': e.message},
549543
};
550544
} catch (e) {
551545
_logger.warning('Hot restart failed: $e');
@@ -641,10 +635,7 @@ class WebSocketProxyService extends ProxyService {
641635

642636
if (clientCount == 0) {
643637
_logger.warning('No clients available for hot reload');
644-
throw NoClientsAvailableException(
645-
'No clients available for hot reload',
646-
operation: 'hot reload',
647-
);
638+
throw NoClientsAvailableException('No clients available for hot reload');
648639
}
649640

650641
// Create tracker for this hot reload request
@@ -705,10 +696,7 @@ class WebSocketProxyService extends ProxyService {
705696

706697
if (clientCount == 0) {
707698
_logger.warning('No clients available for hot restart');
708-
throw NoClientsAvailableException(
709-
'No clients available for hot restart',
710-
operation: 'hot restart',
711-
);
699+
throw NoClientsAvailableException('No clients available for hot restart');
712700
}
713701

714702
// Create tracker for this hot restart request
@@ -774,8 +762,7 @@ class WebSocketProxyService extends ProxyService {
774762
final request = ServiceExtensionRequest.fromArgs(
775763
id: requestId,
776764
method: method,
777-
args:
778-
args != null ? Map<String, dynamic>.from(args) : <String, dynamic>{},
765+
args: <String, Object?>{...?args},
779766
);
780767

781768
// Send the request and get the number of connected clients

0 commit comments

Comments
 (0)