From 10d023dd7bbc6da252fa02ef452fc4142d313bed Mon Sep 17 00:00:00 2001 From: Hemna Date: Tue, 12 Mar 2024 10:37:17 -0400 Subject: [PATCH] Fixed failure with fetch-stats This patch fails nicely with the fetch-stats if it can't connect with the rpc server on the other end. --- aprsd/cmds/fetch_stats.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/aprsd/cmds/fetch_stats.py b/aprsd/cmds/fetch_stats.py index 3f13096..c0a4d42 100644 --- a/aprsd/cmds/fetch_stats.py +++ b/aprsd/cmds/fetch_stats.py @@ -58,7 +58,11 @@ def fetch_stats(ctx, host, port, magic_word): with console.status(msg): client = rpc_client.RPCClient(host, port, magic_word) stats = client.get_stats_dict() - console.print_json(data=stats) + if stats: + console.print_json(data=stats) + else: + LOG.error(f"Failed to fetch stats via RPC aprsd server at {host}:{port}") + return aprsd_title = ( "APRSD " f"[bold cyan]v{stats['aprsd']['version']}[/] "