Adding a nicer error for when user input JSON is invalid.
This commit is contained in:
parent
6a41875556
commit
febf06d3f6
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue