From fbefe15de8ba7881c96c9c6bc28210365142809b Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Fri, 8 Mar 2024 13:16:25 +0000 Subject: [PATCH] Add error handling --- scripts/merge-yaml.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/merge-yaml.js b/scripts/merge-yaml.js index faca9c6..86f6f28 100644 --- a/scripts/merge-yaml.js +++ b/scripts/merge-yaml.js @@ -40,7 +40,12 @@ function sortAndMergeYAMLFiles() { outputString += ` stops: [${item.stops.map(stop => `${stop}`).join(',')}]\n`; }); - fs.writeFileSync('./pis/gw.yaml', outputString); + try { + fs.writeFileSync('./pis/gw.yaml', outputString); + console.log("Overwritten gw.pis") + } catch (err) { + console.error("Error writing gw.pis", err) + } files.forEach(file => { if (file.startsWith('dg_parser')) { @@ -49,7 +54,6 @@ function sortAndMergeYAMLFiles() { } }); - console.log(outputString) } catch(err) { console.error('Error merging YAML:', err) }