fix: put postcount retrieval behind try..catch so errors are handled appropriately

This commit is contained in:
Julian Lam
2024-02-26 11:34:03 -05:00
parent b011595198
commit 28370b1043

View File

@@ -51,8 +51,13 @@ Actors.assert = async (ids, options = {}) => {
}
// Post count
const outbox = actor.outbox ? await activitypub.get('uid', 0, actor.outbox) : { totalItems: 0 };
actor.postcount = outbox.totalItems;
try {
const outbox = actor.outbox ? await activitypub.get('uid', 0, actor.outbox) : { totalItems: 0 };
actor.postcount = outbox.totalItems;
} catch (e) {
// no action required
winston.verbose(`[activitypub/actor.assert] Unable to retrieve post counts for ${actor.id}`);
}
// Followers url for backreference
if (actor.hasOwnProperty('followers') && activitypub.helpers.isUri(actor.followers)) {