From abd899d2952eafdcc9969147d2401f77c9d85599 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Tue, 7 May 2024 13:02:09 -0300 Subject: yaml: fix yaml open/read error reporting --- src/data/yaml.js | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/data/yaml.js b/src/data/yaml.js index b0cc962a..25a1dd0f 100644 --- a/src/data/yaml.js +++ b/src/data/yaml.js @@ -853,18 +853,28 @@ export async function loadYAMLDocumentsFromDataSteps(dataSteps, {dataPath}) { const filePromises = fileLists .map(files => files - .map(async file => { - const {result, aggregate} = - await loadYAMLDocumentsFromFile(file); + .map(file => + loadYAMLDocumentsFromFile(file).then( + ({result, aggregate}) => { + const close = + decorateErrorWithFileFromDataPath(aggregate.close, {dataPath}); - const close = - decorateErrorWithFileFromDataPath(aggregate.close, {dataPath}); + aggregate.close = () => + close({file}); - aggregate.close = - () => close({file}); + return {result, aggregate}; + }, + (error) => { + const aggregate = {}; - return {result, aggregate}; - })); + annotateErrorWithFile(error, path.relative(dataPath, file)); + + aggregate.close = () => { + throw error; + }; + + return {result: [], aggregate}; + }))); const fileListPromises = filePromises -- cgit 1.3.0-6-gf8a5