fedimbed: json decode debug

This commit is contained in:
Cynthia Foxwell 2023-12-02 00:48:42 -07:00
parent fe2a4eb062
commit a08d44cde0
1 changed files with 8 additions and 1 deletions

View File

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