diff --git a/packages/server/src/api/controllers/query.js b/packages/server/src/api/controllers/query.js index 5c88a1c121..66de67e093 100644 --- a/packages/server/src/api/controllers/query.js +++ b/packages/server/src/api/controllers/query.js @@ -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 }