1
0
Fork 0
mirror of synced 2024-06-27 02:20:35 +12:00

Adding a nicer error for when user input JSON is invalid.

This commit is contained in:
mike12345567 2021-02-02 16:44:31 +00:00
parent c74f1011d0
commit 163079d278

View file

@ -48,9 +48,13 @@ async function enrichQueryFields(fields, parameters) {
}
if (enrichedQuery.json || enrichedQuery.customData) {
enrichedQuery.json = JSON.parse(
enrichedQuery.json || enrichedQuery.customData
)
try {
enrichedQuery.json = JSON.parse(
enrichedQuery.json || enrichedQuery.customData
)
} catch (err) {
throw { message: `JSON Invalid - error: ${err}` }
}
delete enrichedQuery.customData
}