Skip to content

Commit

Permalink
Updated the error message.
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelBone committed Aug 6, 2018
1 parent cfec05f commit d9a6f07
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions scraper.js
Expand Up @@ -113,8 +113,12 @@ async function main() {
try {
body = await request({ url: developmentApplicationUrl, proxy: process.env.MORPH_PROXY, headers: headers });
} catch (error) {
let message = error.message.replace(process.env.MORPH_PROXY, "MORPH_PROXY");
console.log(` Could not retrieve application ${element.attribs.href}: ${message}`);
let proxy = process.env.MORPH_PROXY.trim();
let index = proxy.indexOf("://");
if (index >= 0)
proxy = proxy.substring(index + "://".length);
let message = error.message.replace(proxy, "MORPH_PROXY");
console.log(` Error: could not retrieve application ${element.attribs.href}: ${message}`);
continue; // ignore the failure and move on to the next application
}
let $ = cheerio.load(body);
Expand Down

0 comments on commit d9a6f07

Please sign in to comment.