Skip to content

Commit b4427c0

Browse files
authored
Merge pull request #180 from bcgov/swcurran-bundle-error
Display errors when Excel File parsing fails
2 parents 5a1006c + 0a88488 commit b4427c0

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

scripts/genBundle.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,18 @@ fi
8484
# Parse the file using the OCA Parser and then prettify the JSON with jq
8585
${PARSER} parse oca --path "${EXCEL}" | jq . > ${OCABUNDLE}
8686

87+
if [ "${PIPESTATUS[0]}" -ne 0 ] || jq -e 'has("errors")' "${OCABUNDLE}" > /dev/null 2>&1; then
88+
echo "The Excel file did not parse correctly and needs to be fixed."
89+
echo "Parser errors:"
90+
echo ""
91+
cat ${OCABUNDLE}
92+
echo ""
93+
echo "Look for extraneous text / blank strings on the indicated lines."
94+
echo "If necessary, start again from the OCA Excel Template and reapply your changes."
95+
rm ${OCABUNDLE}
96+
exit 1
97+
fi
98+
8799
# Grab out from the OCABundle the capture_base item from an overlay so it can be put into the JSON Files
88100
# The data value may change so grabbing this ensures the added overlays reference the right capture base
89101
CAPTUREBASEITEM=$(grep -m 1 '"capture_base": "' ${OCABUNDLE} )

0 commit comments

Comments
 (0)