Adding a nicer error for when user input JSON is invalid.
This commit is contained in:
parent
c74f1011d0
commit
163079d278
|
@ -48,9 +48,13 @@ async function enrichQueryFields(fields, parameters) {
|
|||
}
|
||||
|
||||
if (enrichedQuery.json || enrichedQuery.customData) {
|
||||
try {
|
||||
enrichedQuery.json = JSON.parse(
|
||||
enrichedQuery.json || enrichedQuery.customData
|
||||
)
|
||||
} catch (err) {
|
||||
throw { message: `JSON Invalid - error: ${err}` }
|
||||
}
|
||||
delete enrichedQuery.customData
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue