Skip to content

Commit

Permalink
Fixed failure with fetch-stats
Browse files Browse the repository at this point in the history
This patch fails nicely with the fetch-stats if it can't connect
with the rpc server on the other end.
  • Loading branch information
hemna committed Mar 12, 2024
1 parent cb9456b commit 10d023d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion aprsd/cmds/fetch_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']}[/] "
Expand Down

0 comments on commit 10d023d

Please sign in to comment.