@@ -365,7 +365,7 @@ def _teardown_state(self) -> None:
365
365
366
366
def _validate_can_request (self ) -> None :
367
367
if self ._boot_status not in (BootStatus .BOOTING , BootStatus .ONLINE ):
368
- raise ServerOffline
368
+ raise ServerOffline ( "Server already offline!" )
369
369
pass # Otherwise always OK to request in RT
370
370
371
371
def _validate_moment_timestamp (self , seconds : Optional [float ]) -> None :
@@ -380,7 +380,7 @@ def send(self, message: Union[SupportsOsc, SequenceABC, str]) -> None:
380
380
:param message: The message to send.
381
381
"""
382
382
if self ._boot_status == BootStatus .OFFLINE :
383
- raise ServerOffline
383
+ raise ServerOffline ( "Server already offline!" )
384
384
osc_protocol : OscProtocol = getattr (self , "_osc_protocol" )
385
385
osc_protocol .send (message )
386
386
@@ -513,7 +513,6 @@ def _lifecycle(self, owned: bool = True) -> None:
513
513
self ._on_lifecycle_event (ServerLifecycleEvent .BOOTED )
514
514
self ._boot_future .set_result (True )
515
515
except TooManyClients :
516
- print ("B" )
517
516
self ._shutdown_future .set_result (ServerShutdownEvent .TOO_MANY_CLIENTS )
518
517
# await shutdown future, osc panic, process panic
519
518
shutdown = self ._shutdown_future .result ()
@@ -578,7 +577,7 @@ def _setup_notifications(self) -> None:
578
577
if response is None or not isinstance (response , (DoneInfo , FailInfo )):
579
578
raise RuntimeError
580
579
if isinstance (response , FailInfo ):
581
- raise TooManyClients
580
+ raise TooManyClients ( "Too many clients connected already" )
582
581
if len (response .other ) == 1 : # supernova doesn't provide a max logins value
583
582
self ._client_id = int (response .other [0 ])
584
583
self ._maximum_logins = self ._options .maximum_logins
@@ -602,7 +601,7 @@ def boot(self, *, options: Optional[Options] = None, **kwargs) -> "Server":
602
601
:param kwargs: Keyword arguments for options.
603
602
"""
604
603
if self ._boot_status != BootStatus .OFFLINE :
605
- raise ServerOnline
604
+ raise ServerOnline ( "Server already online!" )
606
605
self ._boot_status = BootStatus .BOOTING
607
606
self ._options = self ._get_options (options or self ._options , ** kwargs )
608
607
self ._boot_future = concurrent .futures .Future ()
@@ -627,7 +626,7 @@ def connect(self, *, options: Optional[Options] = None, **kwargs) -> "Server":
627
626
:param kwargs: Keyword arguments for options.
628
627
"""
629
628
if self ._boot_status != BootStatus .OFFLINE :
630
- raise ServerOnline
629
+ raise ServerOnline ( "Server already online!" )
631
630
self ._boot_status = BootStatus .BOOTING
632
631
self ._options = self ._get_options (options or self ._options , ** kwargs )
633
632
self ._boot_future = concurrent .futures .Future ()
@@ -641,15 +640,15 @@ def connect(self, *, options: Optional[Options] = None, **kwargs) -> "Server":
641
640
self ._lifecycle_thread .start ()
642
641
if not (self ._boot_future .result ()):
643
642
if self ._shutdown_future .result () == ServerShutdownEvent .TOO_MANY_CLIENTS :
644
- raise TooManyClients
643
+ raise TooManyClients ( "Too many clients connected already" )
645
644
return self
646
645
647
646
def disconnect (self ) -> "Server" :
648
647
"""
649
648
Disconnect from a running server.
650
649
"""
651
650
if self ._boot_status == BootStatus .OFFLINE :
652
- raise ServerOffline
651
+ raise ServerOffline ( "Server already offline!" )
653
652
if self ._is_owner :
654
653
raise OwnedServerShutdown ("Cannot disconnect from owned server." )
655
654
self ._shutdown_future .set_result (ServerShutdownEvent .DISCONNECT )
@@ -988,7 +987,7 @@ def sync(self, sync_id: Optional[int] = None, timeout: float = 1.0) -> "Server":
988
987
:param sync_id: The sync ID to wait on.
989
988
"""
990
989
if self ._boot_status not in (BootStatus .BOOTING , BootStatus .ONLINE ):
991
- raise ServerOffline
990
+ raise ServerOffline ( "Server already offline!" )
992
991
Sync (
993
992
sync_id = sync_id if sync_id is not None else self ._get_next_sync_id ()
994
993
).communicate (server = self , timeout = timeout )
@@ -1188,7 +1187,7 @@ async def _setup_notifications(self) -> None:
1188
1187
if response is None or not isinstance (response , (DoneInfo , FailInfo )):
1189
1188
raise RuntimeError
1190
1189
if isinstance (response , FailInfo ):
1191
- raise TooManyClients
1190
+ raise TooManyClients ( "Too many clients connected already" )
1192
1191
if len (response .other ) == 1 : # supernova doesn't provide a max logins value
1193
1192
self ._client_id = int (response .other [0 ])
1194
1193
self ._maximum_logins = self ._options .maximum_logins
@@ -1214,7 +1213,7 @@ async def boot(
1214
1213
:param kwargs: Keyword arguments for options.
1215
1214
"""
1216
1215
if self ._boot_status != BootStatus .OFFLINE :
1217
- raise ServerOnline
1216
+ raise ServerOnline ( "Server already online!" )
1218
1217
self ._boot_status = BootStatus .BOOTING
1219
1218
self ._options = self ._get_options (options or self ._options , ** kwargs )
1220
1219
loop = asyncio .get_running_loop ()
@@ -1237,7 +1236,7 @@ async def connect(
1237
1236
:param kwargs: Keyword arguments for options.
1238
1237
"""
1239
1238
if self ._boot_status != BootStatus .OFFLINE :
1240
- raise ServerOnline
1239
+ raise ServerOnline ( "Server already online!" )
1241
1240
self ._boot_status = BootStatus .BOOTING
1242
1241
self ._options = self ._get_options (options or self ._options , ** kwargs )
1243
1242
loop = asyncio .get_running_loop ()
@@ -1247,15 +1246,15 @@ async def connect(
1247
1246
self ._lifecycle_task = loop .create_task (self ._lifecycle (owned = False ))
1248
1247
if not (await self ._boot_future ):
1249
1248
if await self ._shutdown_future == ServerShutdownEvent .TOO_MANY_CLIENTS :
1250
- raise TooManyClients
1249
+ raise TooManyClients ( "Too many clients connected already" )
1251
1250
return self
1252
1251
1253
1252
async def disconnect (self ) -> "AsyncServer" :
1254
1253
"""
1255
1254
Disconnect from a running server.
1256
1255
"""
1257
1256
if self ._boot_status == BootStatus .OFFLINE :
1258
- raise ServerOffline
1257
+ raise ServerOffline ( "Server already offline!" )
1259
1258
if self ._is_owner :
1260
1259
raise OwnedServerShutdown ("Cannot disconnect from owned server." )
1261
1260
self ._shutdown_future .set_result (ServerShutdownEvent .DISCONNECT )
@@ -1602,7 +1601,7 @@ async def sync(
1602
1601
:param sync_id: The sync ID to wait on.
1603
1602
"""
1604
1603
if self ._boot_status not in (BootStatus .BOOTING , BootStatus .ONLINE ):
1605
- raise ServerOffline
1604
+ raise ServerOffline ( "Server already offline!" )
1606
1605
await Sync (
1607
1606
sync_id = sync_id if sync_id is not None else self ._get_next_sync_id ()
1608
1607
).communicate_async (server = self , timeout = timeout )
0 commit comments