CLI: error handling invalid nostr client key (#144)

* improve error handling, catch and handle exception around nostr client creation

* add makefile

* apply formatting as per PR feedback

---------

Co-authored-by: callebtc <93376500+callebtc@users.noreply.github.com>
This commit is contained in:
dyKiU
2023-03-16 00:48:34 +00:00
committed by GitHub
parent 70828b59d5
commit 3952979a56

View File

@@ -643,9 +643,12 @@ async def info(ctx: Context):
if settings.tor:
print(f"Tor enabled: {settings.tor}")
if settings.nostr_private_key:
client = NostrClient(private_key=settings.nostr_private_key, connect=False)
print(f"Nostr public key: {client.public_key.bech32()}")
print(f"Nostr relays: {settings.nostr_relays}")
try:
client = NostrClient(private_key=settings.nostr_private_key, connect=False)
print(f"Nostr public key: {client.public_key.bech32()}")
print(f"Nostr relays: {settings.nostr_relays}")
except:
print(f"Nostr: Error. Invalid key.")
if settings.socks_host:
print(f"Socks proxy: {settings.socks_host}:{settings.socks_port}")
print(f"Mint URL: {ctx.obj['HOST']}")