fedimbed: json decode debug

This commit is contained in:
Cynthia Foxwell 2023-12-02 00:48:42 -07:00
parent fe2a4eb062
commit a08d44cde0

View file

@ -171,7 +171,14 @@ async function processUrl(msg, url, spoiler = false) {
let postData; let postData;
if (rawPostData?.startsWith("{")) { if (rawPostData?.startsWith("{")) {
try {
postData = JSON.parse(rawPostData); postData = JSON.parse(rawPostData);
} catch (err) {
logger.error(
"fedimbed",
`Failed to decode JSON for "${url}": ${err}\n "${rawPostData}"`
);
}
} else { } else {
logger.warn("fedimbed", `Got non-JSON for "${url}": ${rawPostData}`); logger.warn("fedimbed", `Got non-JSON for "${url}": ${rawPostData}`);
} }