error handling on receiving no profiles from relay

This commit is contained in:
Believethehype
2023-03-15 19:50:33 +01:00
parent 24ec61a197
commit 882914dfe7
+5 -1
View File
@@ -121,7 +121,11 @@ func GetNostrProfileMetaData(npub string) (nostr.ProfileMetadata, error) {
}
relay.Close()
metadata, err = nostr.ParseMetadata(evs[0])
if len(evs) > 0 {
metadata, err = nostr.ParseMetadata(evs[0])
} else {
err = fmt.Errorf("no profile found for npub %s on relay %s", npub, url)
}
return *metadata, err
}