mirror of
https://github.com/orangecoding/fredy.git
synced 2026-06-16 12:31:07 +00:00
fix: node would crash if axios throw an error
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
const axios = require('axios');
|
||||
const axiosRetry = require('axios-retry');
|
||||
|
||||
axiosRetry(axios, { retryDelay: axiosRetry.exponentialDelay, retries: 3 });
|
||||
|
||||
function makeDriver(headers = {}) {
|
||||
let cookies = '';
|
||||
@@ -15,7 +18,8 @@ function makeDriver(headers = {}) {
|
||||
},
|
||||
});
|
||||
} catch (exception) {
|
||||
callback(exception, null);
|
||||
console.error(`Error while trying to scrape data. Received error: ${exception.message}`);
|
||||
callback(null, []);
|
||||
}
|
||||
|
||||
if (typeof result.data === 'object' && url.toLowerCase().indexOf('scrapingant') !== -1) {
|
||||
|
||||
Reference in New Issue
Block a user