Skip to content

Node.js based forum software built for the modern web

fix: handle ap send errors with object body

Julian Lam450322d12f1b
diff --git a/src/activitypub/index.js b/src/activitypub/index.js
index 8a254a78f4..2043f127a6 100644
--- a/src/activitypub/index.js
+++ b/src/activitypub/index.js
@@ -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) {