fix: handle ap send errors with object body

This commit is contained in:
Julian Lam
2025-01-09 11:17:53 -05:00
parent 7943fcde66
commit 450322d12f

View File

@@ -336,6 +336,9 @@ async function sendMessage(uri, id, type, payload, attempts = 1) {
if (String(response.statusCode).startsWith('2')) {
ActivityPub.helpers.log(`[activitypub/send] Successfully sent ${payload.type} to ${uri}`);
} else {
if (typeof body === 'object') {
throw new Error(JSON.stringify(body));
}
throw new Error(String(body));
}
} catch (e) {