diff --git a/bondfetch.js b/bondfetch.js index 2f685a2..2841f92 100644 --- a/bondfetch.js +++ b/bondfetch.js @@ -4,7 +4,7 @@ const TelegramBot = require('node-telegram-bot-api'); const simCo = require('./simco-credentials'); const tgInfo = require('./telegram-credentials'); -if (!simCo.cookie || !tgInfo.token || !tgInfo.infoChat) { +if (!simCo.cookie || !tgInfo.token || !tgInfo.infoChat || !tgInfo.debugChat) { console.error("ERR: credentials not set.") return; } @@ -24,6 +24,7 @@ const bondFetchProcess = async (url) => { }); var t1 = await BondData.json(); } catch (e) { + tgBot.sendMessage(tgInfo.debugChat, `ERROR: fetching bonds:\n${e}`); console.error(e); } for (let data in t1) { diff --git a/largefetch.js b/largefetch.js index 33cd3e0..d3f6851 100644 --- a/largefetch.js +++ b/largefetch.js @@ -63,6 +63,7 @@ const getFullData = async url => { }) } } else { + tgBot.sendMessage(tgInfo.debugChat, `ERROR: fetching market:\nStatus Code: ${marketData.status}`); throw ("fetch returned status code " + marketData.status); } } @@ -84,6 +85,7 @@ const storeFullData = async marketData => { const querystring = `INSERT INTO marketv2 (kind,price,time, quality) VALUES (${kind},${price},${storedate}, ${quality})` connection.query(querystring, function (error, results, fields) { if (error) { + tgBot.sendMessage(tgInfo.debugChat, `ERROR: fetching market - database error:\n${error}`); return connection.rollback(function () { throw error; }); @@ -100,6 +102,7 @@ const storeFullData = async marketData => { const querystring = `INSERT INTO marketcap (kind,quality,price,amount,time) VALUES (${kind},${quality},${price},${amount},${storedate})`; connection.query(querystring, function (error, results, fields) { if (error) { + tgBot.sendMessage(tgInfo.debugChat, `ERROR: fetching market - database error:\n${error}`); return connection.rollback(function () { throw error; });