Cleanup - centralize the log handling

This commit is contained in:
2024-08-27 12:16:01 -05:00
parent d8891ec75f
commit a6b7fc7afe
15 changed files with 124 additions and 180 deletions

View File

@@ -9,11 +9,8 @@ curl -s -X POST https://api.schwabapi.com/v1/oauth/token \
-d "grant_type=refresh_token&refresh_token=$(<refresh_token.dat)" > temp/accessTokenReqResp.$$.json
jq -e -r .access_token temp/accessTokenReqResp.$$.json > access_token.dat
if [[ $? -ne 0 ]]; then
errMsg="ERROR: GETTING THE ACCESS TOKEN FAILED! $(<temp/accessTokenReqResp.$$.json)"
systemd-cat -t "`basename $0`" -p err <<< ${errMsg}
>&2 echo "${errMsg}"
curl -d "" -X POST "https://deadswitch.kawomi.com/api/v1?topic=trade.schwab.error.getNewAccessToken&secs=1&email=joe@kawomi.com"
exit 1
throw "ERROR: GETTING THE ACCESS TOKEN FAILED! $(<temp/accessTokenReqResp.$$.json)" err
fi
#echo Access Token: $(<access_token.dat)