Error as warning only when falling back to stitching

This commit is contained in:
2024-08-13 15:31:47 -05:00
parent 082ffbb6e4
commit fd90883e79
2 changed files with 15 additions and 7 deletions

View File

@@ -1,15 +1,23 @@
#!/bin/bash
#set -x
symbol=$1
outDir=data/$(date +%Y-%m-%d)
queryString="?symbol=${symbol}"
mkdir -p "${outDir}"
mkdir -p temp
ErrorLogLevel=err
#Handle additional commandline parameters
if [[ $1 == -* ]]; then
if [[ $1 == "-ErrorAsWarning" ]]; then
ErrorLogLevel=warning
shift
fi
fi
symbol=$1
shift
queryString="?symbol=${symbol}"
while [[ $# -gt 0 ]]; do
queryString="${queryString}&$1=$2"
shift; shift
@@ -25,7 +33,7 @@ jqQuery=".symbol"
symbolCheck=$(jq -r ${jqQuery} < temp/optionChain.${symbol}.tmp.$$.json)
if [[ "${symbol}" != "${symbolCheck}" ]]; then
errMsg="ERROR: THE RESPONSE IS INCORRECT! Symbol: _${symbol}_ Check: _${symbolCheck}_ check file _temp/optionChain.${symbol}.tmp.$$.json_"
systemd-cat -t "`basename $0` $1" -p err <<< ${errMsg}
systemd-cat -t "`basename $0` $1" -p ${ErrorLogLevel} <<< ${errMsg}
>&2 echo "${errMsg}"
exit 2
else