Explorar o código

bin/tau: more informative connection error with daemon

Dastan-glitch %!s(int64=2) %!d(string=hai) anos
pai
achega
3fafd85d3c
Modificáronse 1 ficheiros con 5 adicións e 1 borrados
  1. 5 1
      bin/tau/tau-python/api.py

+ 5 - 1
bin/tau/tau-python/api.py

@@ -5,7 +5,11 @@ import sys
 from lib.net import Channel
 
 async def create_channel(server_name, port):
-    reader, writer = await asyncio.open_connection(server_name, port)
+    try:
+        reader, writer = await asyncio.open_connection(server_name, port)
+    except ConnectionRefusedError:
+        print(f"Error: Connection Refused to '{server_name}:{port}', Either because the daemon is down, is currently syncing or wrong url.")
+        sys.exit(-1)
     channel = Channel(reader, writer)
     return channel