diff --git a/lib/whitelist.js b/lib/whitelist.js index b321df88e..88a7d844f 100644 --- a/lib/whitelist.js +++ b/lib/whitelist.js @@ -372,21 +372,25 @@ options.headers['If-Modified-Since'] = whitelistLastModified; } - got(options).then(response => { - const newWhitelist = response.body; - - if (response.statusCode === 500) { - console.error('Error loading domains list from ' + CONFIG.WHITELIST_URL + ' : ' + newWhitelist); - } else if (response.statusCode === 304) { - log('Whitelist respond: 304 (not modified)'); - } else if (!newWhitelist || typeof newWhitelist === 'string') { - console.error('Error loading domains list from ' + CONFIG.WHITELIST_URL + ' : incorrect data: ' + newWhitelist); - } else { - whitelistLastModified = response.headers['last-modified']; - applyParsedWhitelist(newWhitelist); - } + got(options) + .then(response => { + const newWhitelist = response.body; + + if (response.statusCode === 500) { + console.error('Error loading domains list from ' + CONFIG.WHITELIST_URL + ' : ' + newWhitelist); + } else if (response.statusCode === 304) { + log('Whitelist respond: 304 (not modified)'); + } else if (!newWhitelist || typeof newWhitelist === 'string') { + console.error('Error loading domains list from ' + CONFIG.WHITELIST_URL + ' : incorrect data: ' + newWhitelist); + } else { + whitelistLastModified = response.headers['last-modified']; + applyParsedWhitelist(newWhitelist); + } - setTimeout(loadWhitelistUrl, CONFIG.WHITELIST_URL_RELOAD_PERIOD); - }); + setTimeout(loadWhitelistUrl, CONFIG.WHITELIST_URL_RELOAD_PERIOD); + }) + .catch(error => { + console.error('Error loading domains list from ' + CONFIG.WHITELIST_URL + ':', error.message); + }); } - } \ No newline at end of file + }