From 81f516604386e13cbdd2612776adceccdbf8e1a4 Mon Sep 17 00:00:00 2001 From: Roman Axelrod Date: Mon, 14 Aug 2023 15:50:12 +0300 Subject: [PATCH] Print error message to have better understanding of dataObjects errors. --- helpers.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/helpers.js b/helpers.js index 1fc24cb..5b7dda2 100644 --- a/helpers.js +++ b/helpers.js @@ -48,9 +48,11 @@ function getErrorHtml(message = '', errorMessage = '') { } export async function getBlockData(jsonFileName = 'default', {projectPath} = {jsonFileName: 'default'}) { - const data = await readJSONFile(path.join(projectPath, 'data', `${jsonFileName}.json`)); + const filePath = path.join(projectPath, 'data', `${jsonFileName}.json`); + const data = await readJSONFile(filePath); if (data.error) { + console.log(filePath, data.errorMessage.replace(/<[^>]*>?/gm, '')); return {}; }