2 Commits

Author SHA1 Message Date
f7523ae5e2 fix: exit on errors 2018-11-02 16:37:09 -07:00
024a43e20b fix: format undefined fields 2018-11-02 16:37:09 -07:00
2 changed files with 2 additions and 1 deletions

View File

@@ -42,7 +42,7 @@ async function run() {
// scheduled running // scheduled running
if (interval === 0) return; if (interval === 0) return;
logger.debug(`Starting interval (${interval}s)...`); logger.debug(`Starting interval (${interval}s)...`);
runInterval(fetchAndIndex, interval * 1000); runInterval(() => fetchAndIndex().catch(handleError), interval * 1000);
} }
run().catch(handleError); run().catch(handleError);

View File

@@ -2,6 +2,7 @@ import fetch from './fetch.mjs';
const formatNumber = str => str && Number(`${str}`.replace(/[^0-9.-]/, '')); const formatNumber = str => str && Number(`${str}`.replace(/[^0-9.-]/, ''));
const formatString = str => { const formatString = str => {
if (str == null) return 'N/A';
if (typeof str !== 'string') return str; if (typeof str !== 'string') return str;
return str && str.length && str !== 'undefined' ? str.trim() : 'N/A'; return str && str.length && str !== 'undefined' ? str.trim() : 'N/A';
}; };