mirror of
https://github.com/nbd-wtf/nostr-tools.git
synced 2025-12-13 10:28:51 +00:00
catch fetch error on nip05.
This commit is contained in:
11
nip05.ts
11
nip05.ts
@@ -38,9 +38,14 @@ export async function queryProfile(
|
||||
|
||||
if (!name.match(/^[A-Za-z0-9-_]+$/)) return null
|
||||
|
||||
let res = await (
|
||||
await _fetch(`https://${domain}/.well-known/nostr.json?name=${name}`)
|
||||
).json()
|
||||
let res
|
||||
try {
|
||||
res = await (
|
||||
await _fetch(`https://${domain}/.well-known/nostr.json?name=${name}`)
|
||||
).json()
|
||||
} catch (err) {
|
||||
return null
|
||||
}
|
||||
|
||||
if (!res?.names?.[name]) return null
|
||||
|
||||
|
||||
Reference in New Issue
Block a user