Browse Source

Print error message to have better understanding of dataObjects errors.

wordpress-build
Roman Axelrod 2 years ago
parent
commit
81f5166043
  1. 4
      helpers.js

4
helpers.js

@ -48,9 +48,11 @@ function getErrorHtml(message = '', errorMessage = '') {
} }
export async function getBlockData(jsonFileName = 'default', {projectPath} = {jsonFileName: 'default'}) { 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) { if (data.error) {
console.log(filePath, data.errorMessage.replace(/<[^>]*>?/gm, ''));
return {}; return {};
} }

Loading…
Cancel
Save