slightly improve some error messages.

This commit is contained in:
fiatjaf
2025-06-27 13:50:28 -03:00
parent 1e9be3ed84
commit 550c89d8d7
2 changed files with 8 additions and 3 deletions

View File

@@ -77,19 +77,19 @@ func gatherSecretKeyOrBunkerFromArguments(ctx context.Context, c *cli.Command) (
clientKey = nostr.Generate()
}
logverbose("[nip46]: connecting to bunker %s with client key %s", bunkerURL, clientKey.Hex())
logverbose("[nip46]: connecting to %s with client key %s", bunkerURL, clientKey.Hex())
ctx, cancel := context.WithTimeout(ctx, 10*time.Second)
defer cancel()
bunker, err := nip46.ConnectBunker(ctx, clientKey, bunkerURL, nil, func(s string) {
log(color.CyanString("[nip46]: open the following URL: %s"), s)
})
if err != nil {
if errors.Is(ctx.Err(), context.DeadlineExceeded) {
err = fmt.Errorf("timeout waiting for bunker to respond: %w", err)
}
return nostr.SecretKey{}, nil, fmt.Errorf("failed to connect to bunker %s: %w", bunkerURL, err)
return nostr.SecretKey{}, nil, fmt.Errorf("failed to connect to %s: %w", bunkerURL, err)
}
return nostr.SecretKey{}, bunker, err