Better error log of WebFinger

This commit is contained in:
syuilo 2019-02-04 09:02:23 +09:00
parent b4859be098
commit 874c0eae6a
No known key found for this signature in database
GPG Key ID: BDC4C49D06AB9D69

View File

@ -78,7 +78,10 @@ export default async (username: string, _host: string, option?: any, resync?: bo
async function resolveSelf(acctLower: string) {
logger.info(`WebFinger for ${chalk.yellow(acctLower)}`);
const finger = await webFinger(acctLower);
const finger = await webFinger(acctLower).catch(e => {
logger.error(`Failed to WebFinger for ${chalk.yellow(acctLower)}: ${e.message} (${e.status})`);
throw e;
});
const self = finger.links.find(link => link.rel && link.rel.toLowerCase() === 'self');
if (!self) {
throw new Error('self link not found');