debug: improve output for nip05

This commit is contained in:
Alex Gleason 2024-01-01 17:47:15 -06:00
parent d13b7435a7
commit 777ac39ec7
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
1 changed files with 10 additions and 1 deletions

View File

@ -29,7 +29,8 @@ async function lookup(value: string, opts: LookupOpts = {}): Promise<string | nu
const { names } = nostrJsonSchema.parse(await res.json());
return names[name] || null;
} catch (_e) {
} catch (e) {
debug(e);
return null;
}
}
@ -52,6 +53,14 @@ function lookupNip05Cached(value: string): Promise<string | null> {
const result = lookup(value);
nip05Cache.set(value, result);
result.then((result) => {
if (result) {
debug(`Found: ${value} is ${result}`);
} else {
debug(`Not found: ${value} is ${result}`);
}
});
return result;
}