better error reporting on generation failures

This commit is contained in:
Loren Norman 2023-12-12 14:46:15 -05:00
parent 8bc2cde163
commit caf012be1e

View file

@ -27,12 +27,13 @@ const regenerate = () => {
try { JSON.parse(json) }
catch(e) {
valid = false
console.error('Failed to JSON.parse:', json)
console.error(e)
}
const validation = `JSON is ${valid ? 'valid ✅' : 'invalid ❌'}`
jsonOutputDiv.innerText = `${validation}\n\n${json}`
} catch(e) {
jsonOutputDiv.innerText = `JSON Generation Failed:\n${e}`
jsonOutputDiv.innerText = `JSON Generation Failed for:\n${json}\n\n Failed with ${e}`
}
}